2021-04-08 02:35:46 +02:00
|
|
|
# Pulls together NixOS configuration modules according to the
|
|
|
|
# name/role of the host to be built.
|
2021-03-22 22:38:15 +01:00
|
|
|
{ hostName, config, lib, pkgs, ... }:
|
2021-03-19 22:55:48 +01:00
|
|
|
|
|
|
|
let
|
2021-03-22 22:38:15 +01:00
|
|
|
inherit (lib) optionals;
|
2021-03-19 22:55:48 +01:00
|
|
|
|
2021-03-22 20:25:50 +01:00
|
|
|
hostConfig = lib.config.site.hosts.${hostName};
|
|
|
|
in {
|
2021-03-22 22:38:15 +01:00
|
|
|
site = lib.config.site;
|
|
|
|
|
2021-03-19 22:55:48 +01:00
|
|
|
imports = [
|
2021-03-20 02:34:13 +01:00
|
|
|
../lib/config/options.nix
|
2021-03-24 01:20:30 +01:00
|
|
|
./defaults.nix
|
2021-03-24 23:37:09 +01:00
|
|
|
./network.nix
|
2021-04-14 20:04:28 +02:00
|
|
|
./firewall.nix
|
2021-04-12 23:32:21 +02:00
|
|
|
./collectd
|
2021-04-10 14:52:13 +02:00
|
|
|
] ++
|
|
|
|
optionals (hostConfig.role == "server") [
|
2021-08-20 23:58:16 +02:00
|
|
|
./server/default.nix
|
2021-04-10 14:52:13 +02:00
|
|
|
] ++
|
|
|
|
optionals (hostConfig.role == "container") [
|
2021-03-24 01:20:30 +01:00
|
|
|
./container/defaults.nix
|
2021-03-31 02:11:19 +02:00
|
|
|
./container/dhcp-server.nix
|
2021-04-05 15:54:15 +02:00
|
|
|
./container/anon.nix
|
2021-05-03 01:26:57 +02:00
|
|
|
./container/dns.nix
|
2021-04-14 23:07:27 +02:00
|
|
|
./container/dnscache.nix
|
2021-04-10 14:52:13 +02:00
|
|
|
] ++
|
|
|
|
optionals lib.config.site.hosts.${hostName}.isRouter [
|
2021-03-25 04:06:53 +01:00
|
|
|
./container/bird.nix
|
2021-04-10 14:52:13 +02:00
|
|
|
] ++
|
|
|
|
optionals (builtins.match "upstream.*" hostName != null) [
|
2021-04-01 01:16:13 +02:00
|
|
|
./container/upstream.nix
|
2021-05-31 00:41:38 +02:00
|
|
|
./container/upstream/pppoe.nix
|
2021-04-10 14:52:13 +02:00
|
|
|
] ++
|
|
|
|
optionals (hostName == "mgmt-gw") [
|
2021-04-04 22:55:40 +02:00
|
|
|
./container/mgmt-gw.nix
|
2021-06-18 19:56:49 +02:00
|
|
|
] ++
|
|
|
|
optionals (hostName == "netboot") [
|
|
|
|
./container/netboot.nix
|
2021-03-19 22:55:48 +01:00
|
|
|
];
|
|
|
|
}
|