diff options
| author | Seth Flynn <[email protected]> | 2025-02-07 01:57:46 -0500 |
|---|---|---|
| committer | Seth Flynn <[email protected]> | 2025-02-07 22:52:00 -0500 |
| commit | af5215082ef899f01180b6c350f22ce9243830d8 (patch) | |
| tree | 44a12f34e6e1f501ecba8a05658b4407aaa46756 /secrets/toSecrets.nix | |
| parent | 7baba7111bffbf3dafc41c66d7cc138526294f53 (diff) | |
secrets: use module to evaluate
Diffstat (limited to 'secrets/toSecrets.nix')
| -rw-r--r-- | secrets/toSecrets.nix | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/secrets/toSecrets.nix b/secrets/toSecrets.nix deleted file mode 100644 index 3ae33f1..0000000 --- a/secrets/toSecrets.nix +++ /dev/null @@ -1,35 +0,0 @@ -hosts: -let - # Find any public keys from a given system's attributes - findPubkeysIn = - host: - builtins.filter (item: item != null) [ - (host.pubkey or null) - (host.owner or null) - ]; - - # Memorize them for later - publicKeysFor = builtins.mapAttrs (_: findPubkeysIn) hosts; - - # Map secret files meant for `hostname` to an attribute set containing - # their relative path and public keys - # - # See https://github.com/ryantm/agenix/blob/de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6/README.md#tutorial - # as a reference to what this outputs - secretsFrom = - hostname: host: - builtins.listToAttrs ( - map (file: { - name = "${hostname}/${file}"; - value = { - publicKeys = publicKeysFor.${hostname}; - }; - - }) host.files - ); - - # Memorize them all - secretsFor = builtins.mapAttrs secretsFrom hosts; -in -# Now merge them all into one attribute set -builtins.foldl' (acc: secrets: acc // secrets) { } (builtins.attrValues secretsFor) |
