diff --git a/configuration.nix b/configuration.nix index 22e2739..10b8535 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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 ).value; - in fn.ifelse (hostVal != false) - hostVal - (fileContents /secret/hostName); + # Cannot use 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 ).value != false) + + /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; };