From f362644adeb3db42e1f75073dc0d26200fbe690e Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 4 Dec 2026 19:32:04 +0000 Subject: krops: force enstate removals --- krops.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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)} ''); -- cgit v1.3.1