diff options
| author | tv <tv@krebsco.de> | 2026-11-18 13:39:35 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 14:40:45 +0100 |
| commit | ead92457791ef1d89ca2758e103b9f0e755c96e5 (patch) | |
| tree | a4476fed884cb41874e8696ba5b769ef61e31432 | |
| parent | 31b3b525e0e2e287afd15de97eb902e337af8386 (diff) | |
krops: add diff action
diff builds the system on the target like deploy, then shows how its
closure differs from the running system's and which units switching
would stop, start, restart, or reload.
| -rw-r--r-- | krops.nix | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -2,7 +2,12 @@ # krops.nix - deployment entry point # # SYNOPSIS -# $(nix-build krops.nix --no-out-link --argstr name HOSTNAME -A deploy) +# $(nix-build krops.nix --no-out-link --argstr name HOSTNAME -A ACTION) +# +# ACTIONS +# deploy build the system on the target and switch to it +# diff build the system on the target and show what switching to it +# would change # { lib ? import ~/sync/src/krops/lib , pkgs ? import ~/sync/src/krops/pkgs {} @@ -41,9 +46,12 @@ ]; deploy = hrm.legacy.deploy; + diff = hrm.legacy.diff; hrm.legacy.deploy = mkAction "legacy" "deploy"; + hrm.legacy.diff = mkAction "legacy" "diff"; hrm.flake.deploy = mkAction "flake" "deploy"; + hrm.flake.diff = mkAction "flake" "diff"; mkAction = build-method: deploy-action: let target' = lib.mkTarget target; @@ -84,6 +92,11 @@ echo 'Configuration is already up to date' >&2 fi ''; + diff = /* sh */ '' + nix --extra-experimental-features nix-command \ + store diff-closures /run/current-system "$system" + "$system"/bin/switch-to-configuration dry-activate + ''; }} ''} ''; |
