From 3f0cdaf0aab074e9c3622edb27fdcf19c2975702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Fri, 13 Dec 2024 12:34:58 +0100 Subject: [PATCH] Replace `concatMapAttrs` + `filterAttrs` by `concatMapAttrs` + `optionalAttrs` --- secrets/flake-part.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/secrets/flake-part.nix b/secrets/flake-part.nix index 9f9b7f4..aa7a2eb 100644 --- a/secrets/flake-part.nix +++ b/secrets/flake-part.nix @@ -6,7 +6,7 @@ let inherit (builtins) elem; - inherit (lib.attrsets) concatMapAttrs filterAttrs; + inherit (lib.attrsets) concatMapAttrs optionalAttrs; inherit (lib.strings) removeSuffix; secrets = import ./secrets.nix; @@ -27,9 +27,12 @@ in ''; }; - config.age.secrets = concatMapAttrs (name: _: { - ${removeSuffix ".age" name}.file = ./. + "/${name}"; - }) (filterAttrs (_: secret: elem config.x_fediversity.hostPublicKey secret.publicKeys) secrets); + config.age.secrets = concatMapAttrs ( + name: secret: + optionalAttrs (elem config.x_fediversity.hostPublicKey secret.publicKeys) ({ + ${removeSuffix ".age" name}.file = ./. + "/${name}"; + }) + ) secrets; } ); };