Skip to content

Commit 55d7272

Browse files
committed
feat: add support for dontLoad in agenix secrets
Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
1 parent cad0152 commit 55d7272

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

System/Common/Misc/secrets.nix

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ let
2222
inherit (lib.strings) removeSuffix;
2323

2424
ageFiles =
25-
attrNames config' |> filter (v: config'.${v} ? publicKeys) |> (x: genAttrs x (v: config'.${v}));
25+
attrNames config'
26+
|> filter (
27+
v: config'.${v} ? publicKeys && !(config'.${v} ? dontLoad && config'.${v}.dontLoad == true)
28+
)
29+
|> (x: genAttrs x (v: config'.${v}));
2630

2731
systemPublicKeys =
2832
config'.system.${config.networking.hostName}.secrets
@@ -73,11 +77,18 @@ in
7377
];
7478
in
7579
{
76-
age.identityPaths = lib.pipe (config'.secrets or { }) [
77-
(filterAttrs (n: v: v ? pkeyfile && v.pkeyfile != null))
78-
(mapAttrs (_: v: v.pkeyfile))
79-
attrValues
80-
];
80+
age.identityPaths =
81+
lib.pipe (config'.secrets or { }) [
82+
(filterAttrs (n: v: v ? pkeyfile && v.pkeyfile != null))
83+
(mapAttrs (_: v: v.pkeyfile))
84+
attrValues
85+
]
86+
++
87+
# Some users don't actually need agenix setup, but since this module
88+
# does it anyway, that's an issue.
89+
# age.identityPaths can never be empty. To fix that, well, we have
90+
# this beauty right here.
91+
[ "/some/random/trash/path" ];
8192

8293
age.secrets = lib.pipe ageFiles [
8394
(filterAttrs (n: v: (intersectLists v.publicKeys publicKeys) != [ ]))

0 commit comments

Comments
 (0)