From cfdfa6ba29960226f899a6c8de640d450944f79f Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 4 Dec 2026 16:18:16 +0000 Subject: krops: diff.enstate --- krops.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/krops.nix b/krops.nix index 3d9aa4e1..061374b7 100644 --- a/krops.nix +++ b/krops.nix @@ -9,6 +9,9 @@ # diff build the system on the target and show what switching to it # would change, and what its enstate would do with the # submissions +# diff.enstate +# show what the running system's enstate would do with the +# submissions, without delivering them # enstate deliver only the enstate submissions, for the running system to # take # bootimg build the boot image (spec.nix's bootimg, an attribute of the @@ -154,7 +157,9 @@ rec { lib.filterAttrs (name: _: lib.hasPrefix "secrets" name) sources; deploy = hrm.legacy.deploy; - diff = hrm.legacy.diff; + diff = hrm.legacy.diff // { + enstate = enstateDiff; + }; hrm.legacy.deploy = mkAction "legacy" "deploy"; hrm.legacy.diff = mkAction "legacy" "diff"; @@ -289,6 +294,19 @@ rec { ''} ''; + # What enstate would do with the submissions, under the running system. + enstateDiff = + assert lib.assertMsg (sourceLists != {}) + "${name}: no enstate sources to submit"; + pkgs.writers.writeDash "${name}-diff-enstate" /* sh */ '' + set -efu + ${enstateSteps.packAndCopy} + ${pkgs.krops.runShell (lib.mkTarget target) {} /* sh */ '' + set -efu + ${enstateSteps.plan "/run/current-system"} + ''} + ''; + mkTargetBuildAction = build-method: deploy-action: let target' = lib.mkTarget target; name' = "${name}-deploy-${build-method}-${deploy-action}"; -- cgit v1.3.1