lib/flake-helper.nix: Automatically load secrets from hosts secrets directory
This commit is contained in:
@@ -31,6 +31,14 @@ rec {
|
||||
agenix.nixosModules.default
|
||||
solid-xmpp-alarm.nixosModules.solid-xmpp-alarm
|
||||
(../hosts + "/${name}/configuration.nix")
|
||||
# Automatically load secrets from the hosts secrets directory
|
||||
({ lib, ... }: let
|
||||
secretsPath = ../hosts + "/${name}/secrets";
|
||||
in {
|
||||
age.secrets = lib.mapAttrs' (filename: _: lib.nameValuePair (lib.removeSuffix ".age" filename) {
|
||||
file = secretsPath + "/${filename}";
|
||||
}) (lib.filterAttrs (name: type: (type == "regular") && (lib.hasSuffix ".age" name) ) (if builtins.pathExists secretsPath then builtins.readDir secretsPath else {}));
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user