40 lines
978 B
Nix
40 lines
978 B
Nix
# Pulls together NixOS configuration modules according to the
|
|
# name/role of the host to be built.
|
|
{ hostName, config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib) optionals;
|
|
|
|
hostConfig = lib.config.site.hosts.${hostName};
|
|
in {
|
|
site = lib.config.site;
|
|
|
|
imports = [
|
|
../lib/config/options.nix
|
|
./defaults.nix
|
|
./network.nix
|
|
./collectd.nix
|
|
]
|
|
++ optionals (hostConfig.role == "server") [
|
|
./server/lxc-containers.nix
|
|
./server/network.nix
|
|
]
|
|
++ optionals (hostName == "server2") [
|
|
./server/server2.nix
|
|
]
|
|
++ optionals (hostConfig.role == "container") [
|
|
./container/defaults.nix
|
|
./container/dhcp-server.nix
|
|
./container/anon.nix
|
|
] ++ optionals (
|
|
hostConfig.role == "container" &&
|
|
lib.config.site.hosts.${hostName}.isRouter
|
|
) [
|
|
./container/bird.nix
|
|
] ++ optionals (builtins.match "upstream.*" hostName != null) [
|
|
./container/upstream.nix
|
|
] ++ optionals (hostName == "mgmt-gw") [
|
|
./container/mgmt-gw.nix
|
|
];
|
|
}
|