1
0
Fork 0
nixos/configuration.nix

28 lines
793 B
Nix

{ 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 = let
hostVal = (tryEval <hostName>).value;
in fn.ifelse (hostVal != false)
hostVal
(fileContents /secret/hostName);
machinePath = (builtins.toPath ( ./machines + ("/" + hostName)));
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; };
in {
imports = [
./options/machine.nix
./services/mailserver/default.nix
] ++ machineFiles
++ configFiles
++ pkgsFiles
++ serviceFiles;
}