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-03-22 22:38:15 +01:00
|
|
|
]
|
|
|
|
++ optionals (hostConfig.role == "server") [
|
2021-03-24 01:20:30 +01:00
|
|
|
./server/lxc-containers.nix
|
2021-03-24 22:23:09 +01:00
|
|
|
./server/network.nix
|
2021-03-22 22:38:15 +01:00
|
|
|
]
|
2021-04-04 21:59:17 +02:00
|
|
|
++ optionals (hostName == "server2") [
|
|
|
|
./server/server2.nix
|
|
|
|
]
|
2021-03-22 22:38:15 +01: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-03-25 04:06:53 +01:00
|
|
|
] ++ optionals (
|
|
|
|
hostConfig.role == "container" &&
|
|
|
|
lib.config.site.hosts.${hostName}.isRouter
|
|
|
|
) [
|
|
|
|
./container/bird.nix
|
2021-04-05 15:54:15 +02:00
|
|
|
] ++ optionals (builtins.match "upstream.*" hostName != null) [
|
2021-04-01 01:16:13 +02:00
|
|
|
./container/upstream.nix
|
2021-04-05 15:54:15 +02:00
|
|
|
] ++ optionals (hostName == "mgmt-gw") [
|
2021-04-04 22:55:40 +02:00
|
|
|
./container/mgmt-gw.nix
|
2021-03-19 22:55:48 +01:00
|
|
|
];
|
|
|
|
}
|