sops: fix module to accept missing ./sops dir
This commit is contained in:
@@ -45,13 +45,17 @@
|
|||||||
'';
|
'';
|
||||||
sops.secrets =
|
sops.secrets =
|
||||||
let
|
let
|
||||||
|
secretsDir = config.clanCore.clanDir + "/sops/secrets";
|
||||||
encryptedForThisMachine = name: type:
|
encryptedForThisMachine = name: type:
|
||||||
let
|
let
|
||||||
symlink = config.clanCore.clanDir + "/sops/secrets/${name}/machines/${config.clanCore.machineName}";
|
symlink = secretsDir + "/${name}/machines/${config.clanCore.machineName}";
|
||||||
in
|
in
|
||||||
# WTF, nix bug, my symlink is in the nixos module detected as a directory also it works in the repl
|
# 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");
|
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
|
in
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(name: _: {
|
(name: _: {
|
||||||
|
|||||||
Reference in New Issue
Block a user