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
|
||||
fn = import ./fn.nix { inherit lib; };
|
||||
# hostName can be set with -I hostName=$HOSTNAME, defaults to the contents of /secret/hostName
|
||||
hostName = let
|
||||
hostVal = (tryEval <hostName>).value;
|
||||
in fn.ifelse (hostVal != false)
|
||||
hostVal
|
||||
(fileContents /secret/hostName);
|
||||
# Cannot use <hostName> here as those evaluations only work with existing paths >.<
|
||||
# hostName and secretPtah can be set with -I hostName=$HOSTNAME and -I secretPath=$SECRETPATH respectively
|
||||
# , defaults to the contents of /secret/hostName
|
||||
secretPath = fn.ifelse ((tryEval <secretPath>).value != false)
|
||||
<secretPath>
|
||||
/secret;
|
||||
hostName = (findFirst
|
||||
(elem: elem.prefix == "hostName")
|
||||
{ path = (fileContents "${secretPath}/hostName"); }
|
||||
nixPath
|
||||
).path;
|
||||
machinePath = (builtins.toPath ( ./machines + ("/" + hostName)));
|
||||
machineFiles = fn.lst { p = machinePath; b = true; };
|
||||
configFiles = fn.lst { p = (toString ./config); b = true; };
|
||||
|
|
Loading…
Reference in a new issue