forked from zentralwerk/network
43 lines
1002 B
Nix
43 lines
1002 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
|
|
./firewall.nix
|
|
./collectd
|
|
] ++
|
|
optionals (hostConfig.role == "server") [
|
|
./server/lxc-containers.nix
|
|
./server/network.nix
|
|
./server/qemu.nix
|
|
] ++
|
|
optionals (hostName == "server2") [
|
|
./server/server2.nix
|
|
] ++
|
|
optionals (hostConfig.role == "container") [
|
|
./container/defaults.nix
|
|
./container/dhcp-server.nix
|
|
./container/anon.nix
|
|
./container/dnscache.nix
|
|
] ++
|
|
optionals 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
|
|
];
|
|
}
|