summaryrefslogtreecommitdiff
path: root/secrets/toSecrets.nix
diff options
context:
space:
mode:
Diffstat (limited to 'secrets/toSecrets.nix')
-rw-r--r--secrets/toSecrets.nix34
1 files changed, 14 insertions, 20 deletions
diff --git a/secrets/toSecrets.nix b/secrets/toSecrets.nix
index 3d495c6..fff6936 100644
--- a/secrets/toSecrets.nix
+++ b/secrets/toSecrets.nix
@@ -1,25 +1,19 @@
-hosts: let
- optional = attrset: val:
- if attrset ? ${val}
- then [attrset.${val}]
- else [];
+hosts:
+let
+ optional = attrset: val: if attrset ? ${val} then [ attrset.${val} ] else [ ];
mkPubkeys = host: optional host "pubkey" ++ optional host "owner";
- op = acc: host:
+ op =
+ acc: host:
acc
- // (
- builtins.listToAttrs (
- map (
- file: {
- name = "${host}/${file}";
- value = {
- publicKeys = mkPubkeys hosts.${host};
- };
- }
- )
- hosts.${host}.files
- )
- );
+ // (builtins.listToAttrs (
+ map (file: {
+ name = "${host}/${file}";
+ value = {
+ publicKeys = mkPubkeys hosts.${host};
+ };
+ }) hosts.${host}.files
+ ));
in
- builtins.foldl' op {} (builtins.attrNames hosts)
+builtins.foldl' op { } (builtins.attrNames hosts)