summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-04 19:32:04 +0000
committertv <tv@krebsco.de>2026-12-04 19:32:04 +0000
commitf362644adeb3db42e1f75073dc0d26200fbe690e (patch)
tree66f2e8293c00e3c73f2e103bb84011009e567485
parentaa84402138ed186890ca1763b17d0bfef9c107e6 (diff)
krops: force enstate removals
-rw-r--r--krops.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/krops.nix b/krops.nix
index 061374b7..e406159c 100644
--- a/krops.nix
+++ b/krops.nix
@@ -32,6 +32,9 @@
# their pinned revisions: a comma-separated list of NAME (the
# directory ~/sync/src/NAME) or NAME=PATH (an absolute path),
# e.g. mobile-nixos to try another kernel
+# force enstate removals to force, for this delivery: a comma-separated
+# list of CHANNEL/SLOT, e.g. secrets/wiregrill.key, which may
+# leave a required slot empty, and what needs it failing
#
# TARGET BUILDS
# A host without builders gets all sources, its secrets among them, and
@@ -64,6 +67,7 @@
, target ? null
, switch ? "switch"
, checkouts ? ""
+, force ? ""
}@args:
assert builtins.elem switch [ "switch" "boot" "test" ];
@@ -94,6 +98,17 @@ let
hostConfig = local.legacy.nixosConfigurations.${name}.config;
sourceLists = hostConfig.enstate.sourceLists or {};
+ # The removals to force, by channel; checked whatever the action.
+ forced = lib.foldl'
+ (acc: address: let
+ channel = lib.head (lib.splitString "/" address);
+ in
+ assert sourceLists ? ${channel}
+ || throw "krops.nix: force: ${address}: no such channel to submit";
+ acc // { ${channel} = acc.${channel} or [] ++ [ address ]; })
+ {}
+ (builtins.filter (item: item != "") (lib.splitString "," force));
+
# A source pinned in sources.json, fetched with git.
gitSource = source: let
entry = (lib.importJSON ./sources.json).${source};
@@ -104,7 +119,7 @@ let
};
};
in
-rec {
+builtins.seq forced rec {
spec = {
nixpkgs = "nixos-26.05";
@@ -209,6 +224,7 @@ rec {
${lib.concatStrings (lib.mapAttrsToList (channel: sourceList: /* sh */ ''
${local.pkgs.enstate}/bin/enstate \
--pack ${pkgs.writers.writeJSON "${name}-enstate-${channel}.json" (lib.recursiveUpdate sourceList { meta.importer = importers; })} \
+ ${lib.concatMapStrings (address: "--force=${lib.escapeShellArg address} ") (forced.${channel} or [])}\
--out "$1"/${channel}
'') sourceLists)}
'');