From ead92457791ef1d89ca2758e103b9f0e755c96e5 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 13:39:35 +0000 Subject: 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. --- krops.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'krops.nix') diff --git a/krops.nix b/krops.nix index 6681007..d9885f8 100644 --- a/krops.nix +++ b/krops.nix @@ -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 + ''; }} ''} ''; -- cgit v1.3.1