diff --git a/configuration.nix b/configuration.nix index fa4566d..e5abe04 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,10 +1,16 @@ { lib, ... }: +with builtins; 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 = (findFirst (elem: elem.prefix == "hostName") { path = (fileContents /secret/hostName); } builtins.nixPath).path; + hostName = let + hostVal = (tryEval ).value; + in fn.ifelse (hostVal != false) + hostVal + (fileContents /secret/hostName); machinePath = (builtins.toPath ( ./machines + ("/" + hostName))); machineConf = machinePath + "/configuration.nix"; machineOpts = machinePath + "/options.nix"; diff --git a/options/machine.nix b/options/machine.nix index 598cd4e..5f8087f 100644 --- a/options/machine.nix +++ b/options/machine.nix @@ -68,7 +68,8 @@ in { }; secretPath = mkOption { type = types.str; - default = (findFirst (elem: elem.prefix == "secretPath") { path = "/secret"; } builtins.nixPath).path; + default = let sPathVal = (tryEval ).value; + in fn.ifelse (sPathVal != false) sPathVal "/secret"; description = '' Path to you systems secret folder containing files with sensitive information. '';