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