2019-05-09 18:28:40 +02:00
|
|
|
{ lib, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
2020-03-28 20:03:48 +01:00
|
|
|
with builtins;
|
2019-03-17 11:43:14 +01:00
|
|
|
with lib;
|
|
|
|
|
2019-02-26 13:44:40 +01:00
|
|
|
let
|
2020-03-28 20:03:48 +01:00
|
|
|
fn = import ./fn.nix { inherit lib; };
|
2019-09-07 05:22:25 +02:00
|
|
|
# hostName can be set with -I hostName=$HOSTNAME, defaults to the contents of /secret/hostName
|
2020-03-28 20:03:48 +01:00
|
|
|
hostName = let
|
|
|
|
hostVal = (tryEval <hostName>).value;
|
|
|
|
in fn.ifelse (hostVal != false)
|
|
|
|
hostVal
|
|
|
|
(fileContents /secret/hostName);
|
2019-09-07 05:22:25 +02:00
|
|
|
machinePath = (builtins.toPath ( ./machines + ("/" + hostName)));
|
2020-03-29 09:10:14 +02:00
|
|
|
machineFiles = fn.lst { p = machinePath; b = true; };
|
|
|
|
configFiles = fn.lst { p = (toString ./config); b = true; };
|
|
|
|
pkgsFiles = fn.lst { p = (toString ./pkgs); b = true; };
|
|
|
|
serviceFiles = fn.lst { p = (toString ./services); b = true; };
|
2019-03-23 02:50:48 +01:00
|
|
|
in {
|
2019-02-26 13:44:40 +01:00
|
|
|
imports = [
|
2020-03-29 09:10:14 +02:00
|
|
|
./options/machine.nix
|
|
|
|
./services/mailserver/default.nix
|
|
|
|
] ++ machineFiles
|
|
|
|
++ configFiles
|
|
|
|
++ pkgsFiles
|
|
|
|
++ serviceFiles;
|
2019-02-26 13:44:40 +01:00
|
|
|
}
|