diff --git a/flake-parts/action-flake-update/default.nix b/flake-parts/action-flake-update/default.nix new file mode 100644 index 0000000..3b18ba3 --- /dev/null +++ b/flake-parts/action-flake-update/default.nix @@ -0,0 +1,24 @@ +{ + perSystem = + { config + , pkgs + , ... + }: + let + name = builtins.baseNameOf ./.; + script = config.writers.writePureShellScriptBin + name + [ + pkgs.bash + pkgs.coreutils + pkgs.git + pkgs.nix + ] + '' + bash ${./script.sh} + ''; + in + { + packages.${name} = script; + }; +} diff --git a/flake-parts/action-flake-update/script.sh b/flake-parts/action-flake-update/script.sh new file mode 100644 index 0000000..01666de --- /dev/null +++ b/flake-parts/action-flake-update/script.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +COMMIT_MSG="update flake lock - $(date --iso-8601=minutes)" + +nix --experimental-features "nix-command flakes" \ + flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"