Replace concatMapAttrs + filterAttrs by concatMapAttrs + optionalAttrs

This commit is contained in:
Nicolas Jeannerod 2024-12-13 12:34:58 +01:00
parent 377ad0ea6e
commit 3f0cdaf0aa
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8

View file

@ -6,7 +6,7 @@
let let
inherit (builtins) elem; inherit (builtins) elem;
inherit (lib.attrsets) concatMapAttrs filterAttrs; inherit (lib.attrsets) concatMapAttrs optionalAttrs;
inherit (lib.strings) removeSuffix; inherit (lib.strings) removeSuffix;
secrets = import ./secrets.nix; secrets = import ./secrets.nix;
@ -27,9 +27,12 @@ in
''; '';
}; };
config.age.secrets = concatMapAttrs (name: _: { config.age.secrets = concatMapAttrs (
name: secret:
optionalAttrs (elem config.x_fediversity.hostPublicKey secret.publicKeys) ({
${removeSuffix ".age" name}.file = ./. + "/${name}"; ${removeSuffix ".age" name}.file = ./. + "/${name}";
}) (filterAttrs (_: secret: elem config.x_fediversity.hostPublicKey secret.publicKeys) secrets); })
) secrets;
} }
); );
}; };