refactor(secrets): simplify secrets

This commit is contained in:
2026-04-20 19:17:37 +02:00
parent b62f3c20ac
commit 72c3710a3c
9 changed files with 87 additions and 80 deletions

View File

@@ -2,19 +2,25 @@
{
mkSopsSecrets =
sopsDir: group: names: extraOpts:
sopsDir: owner: groups:
let
file = "${group}.yaml";
opts = lib.optionalAttrs (owner != null) { inherit owner; };
mkGroup =
group: names:
let
file = "${group}.yaml";
in
lib.foldl' lib.mergeAttrs { } (
map (name: {
"${group}/${name}" = {
sopsFile = "${sopsDir}/${file}";
key = name;
}
// opts;
}) names
);
in
lib.foldl' lib.mergeAttrs { } (
map (name: {
"${group}/${name}" = {
sopsFile = "${sopsDir}/${file}";
key = name;
}
// extraOpts;
}) names
);
lib.foldl' lib.mergeAttrs { } (lib.mapAttrsToList mkGroup groups);
sopsAvailability =
config: osConfig: