sops: fix module to accept missing ./sops dir
This commit is contained in:
parent
03808d9fbc
commit
ac7e3f6407
|
@ -45,13 +45,17 @@
|
|||
'';
|
||||
sops.secrets =
|
||||
let
|
||||
secretsDir = config.clanCore.clanDir + "/sops/secrets";
|
||||
encryptedForThisMachine = name: type:
|
||||
let
|
||||
symlink = config.clanCore.clanDir + "/sops/secrets/${name}/machines/${config.clanCore.machineName}";
|
||||
symlink = secretsDir + "/${name}/machines/${config.clanCore.machineName}";
|
||||
in
|
||||
# WTF, nix bug, my symlink is in the nixos module detected as a directory also it works in the repl
|
||||
type == "directory" && (builtins.readFileType symlink == "directory" || builtins.readFileType symlink == "symlink");
|
||||
secrets = lib.filterAttrs encryptedForThisMachine (builtins.readDir (config.clanCore.clanDir + "/sops/secrets"));
|
||||
secrets =
|
||||
if !builtins.pathExists secretsDir
|
||||
then { }
|
||||
else lib.filterAttrs encryptedForThisMachine (builtins.readDir secretsDir);
|
||||
in
|
||||
builtins.mapAttrs
|
||||
(name: _: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user