Files
nixfiles/secrets.nix
T
jackos1998andClaude Opus 5.5 68de43b467
Update docs / update (push) Failing after 1m44s
CI / Check, build and cache nixfiles (push) Canceled after 8m38s
secrets: Name host keys for slop-broker approvals
Approvals list host keys abbreviated, which says little about which box
a secret goes to. Write each system's name after its key as the key's
comment, which age ignores and slop-broker shows as the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:09:08 +00:00

28 lines
888 B
Nix

let
self = getFlake (toString ./.);
inherit (self) lib;
inherit (builtins) mapAttrs readFile getFlake;
inherit (lib) fileContents optional flatten zipAttrsWith nameValuePair mapAttrs' mapAttrsToList;
secretPath = p: "secrets/${p}.age";
defaultKeys = [
(fileContents .keys/dev.pub)
# `slop-broker` on `palace`, which changes secrets for agents
(fileContents .keys/slop-broker.pub)
];
secretKeys =
zipAttrsWith
(_: keys: flatten (keys ++ defaultKeys))
(mapAttrsToList
# The comment names the key in `slop-broker` approvals; age ignores it
(name: c: let cfg = c.config.my.secrets; in mapAttrs'
(f: _: nameValuePair
(secretPath f)
(optional (cfg.key != null) "${cfg.key} ${name}"))
cfg.files)
self.nixosConfigurations);
in
mapAttrs (_: keys: { publicKeys = keys; }) secretKeys