fix machines folder not beeing present yet
This commit is contained in:
parent
5dd318e637
commit
0a3982d0ac
|
@ -5,13 +5,13 @@
|
|||
}:
|
||||
let
|
||||
machinesDirs =
|
||||
if builtins.pathExists (directory + /machines)
|
||||
then builtins.readDir (directory + /machines)
|
||||
if builtins.pathExists "${directory}/machines"
|
||||
then builtins.readDir "${directory}/machines"
|
||||
else { };
|
||||
|
||||
machineSettings = machineName:
|
||||
if builtins.pathExists (directory + /machines/${machineName}/settings.json)
|
||||
then builtins.fromJSON (builtins.readFile (directory + /machines/${machineName}/settings.json))
|
||||
if builtins.pathExists "${directory}/machines/${machineName}/settings.json"
|
||||
then builtins.fromJSON (builtins.readFile "${directory}/machines/${machineName}/settings.json")
|
||||
else { };
|
||||
|
||||
nixosConfigurations = lib.mapAttrs
|
||||
|
|
|
@ -48,18 +48,18 @@
|
|||
secretsDir = config.clanCore.clanDir + "/sops/secrets";
|
||||
encryptedForThisMachine = name: type:
|
||||
let
|
||||
symlink = secretsDir + "/${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");
|
||||
type == "directory" && builtins.pathExists symlink && (builtins.readFileType symlink == "directory" || builtins.readFileType symlink == "symlink");
|
||||
secrets =
|
||||
if !builtins.pathExists secretsDir
|
||||
if !(builtins.pathExists secretsDir)
|
||||
then { }
|
||||
else lib.filterAttrs encryptedForThisMachine (builtins.readDir secretsDir);
|
||||
in
|
||||
builtins.mapAttrs
|
||||
(name: _: {
|
||||
sopsFile = config.clanCore.clanDir + "/sops/secrets/${name}/secret";
|
||||
sopsFile = "${config.clanCore.clanDir}/sops/secrets/${name}/secret";
|
||||
format = "binary";
|
||||
})
|
||||
secrets;
|
||||
|
|
Loading…
Reference in New Issue
Block a user