Properly set temp hostName and secretPath for configuration.nix.
This commit is contained in:
parent
c543303ab9
commit
1476ff6acb
1 changed files with 11 additions and 6 deletions
|
@ -5,12 +5,17 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
fn = import ./fn.nix { inherit lib; };
|
fn = import ./fn.nix { inherit lib; };
|
||||||
# hostName can be set with -I hostName=$HOSTNAME, defaults to the contents of /secret/hostName
|
# Cannot use <hostName> here as those evaluations only work with existing paths >.<
|
||||||
hostName = let
|
# hostName and secretPtah can be set with -I hostName=$HOSTNAME and -I secretPath=$SECRETPATH respectively
|
||||||
hostVal = (tryEval <hostName>).value;
|
# , defaults to the contents of /secret/hostName
|
||||||
in fn.ifelse (hostVal != false)
|
secretPath = fn.ifelse ((tryEval <secretPath>).value != false)
|
||||||
hostVal
|
<secretPath>
|
||||||
(fileContents /secret/hostName);
|
/secret;
|
||||||
|
hostName = (findFirst
|
||||||
|
(elem: elem.prefix == "hostName")
|
||||||
|
{ path = (fileContents "${secretPath}/hostName"); }
|
||||||
|
nixPath
|
||||||
|
).path;
|
||||||
machinePath = (builtins.toPath ( ./machines + ("/" + hostName)));
|
machinePath = (builtins.toPath ( ./machines + ("/" + hostName)));
|
||||||
machineFiles = fn.lst { p = machinePath; b = true; };
|
machineFiles = fn.lst { p = machinePath; b = true; };
|
||||||
configFiles = fn.lst { p = (toString ./config); b = true; };
|
configFiles = fn.lst { p = (toString ./config); b = true; };
|
||||||
|
|
Loading…
Reference in a new issue