lib/flake-helper.nix: Automatically load secrets from hosts secrets directory
This commit is contained in:
parent
09b043c26c
commit
d2472c79ee
@ -6,8 +6,6 @@
|
||||
./hardware-configuration.nix
|
||||
../../configuration/proxmox-vm
|
||||
|
||||
./secrets
|
||||
|
||||
./restic-server.nix
|
||||
];
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
age.secrets.restic-server-cyan-htpasswd.file = ./restic-server-cyan-htpasswd.age;
|
||||
}
|
@ -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 {}));
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user