summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-04 16:18:16 +0000
committertv <tv@krebsco.de>2026-12-04 16:18:16 +0000
commitcfdfa6ba29960226f899a6c8de640d450944f79f (patch)
tree22dd6d9b3423eab02038148a2500beee3bc89eb0
parentf07c631126720f88985dadab5961c96931ed60ea (diff)
krops: diff.enstate
-rw-r--r--krops.nix20
1 files changed, 19 insertions, 1 deletions
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}";