network/nix/nixos-module/default.nix

47 lines
1.0 KiB
Nix
Raw Permalink Normal View History

2021-04-08 02:35:46 +02:00
# Pulls together NixOS configuration modules according to the
# name/role of the host to be built.
2024-04-14 13:44:00 +02:00
{ hostName, lib, ... }:
2021-03-19 22:55:48 +01:00
let
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 {
2024-04-14 13:44:00 +02:00
inherit (lib.config) site;
2021-03-19 22:55:48 +01:00
imports = [
../lib/config/options.nix
2021-03-24 01:20:30 +01:00
./defaults.nix
2021-03-24 23:37:09 +01:00
./network.nix
./firewall.nix
./collectd
2021-04-10 14:52:13 +02:00
] ++
optionals (hostConfig.role == "server") [
./server/default.nix
2021-04-10 14:52:13 +02:00
] ++
optionals (hostConfig.role == "container") [
./container/lxc-config.nix
2021-03-24 01:20:30 +01:00
./container/defaults.nix
./container/dhcp-server.nix
./container/wireguard.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 [
./container/bird.nix
2021-04-10 14:52:13 +02:00
] ++
optionals (
builtins.match "upstream.*" hostName != null ||
hostName == "flpk-gw"
) [
./container/upstream.nix
./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
] ++
2022-03-01 22:51:31 +01:00
optionals (hostName == "vpn-gw") [
./container/vpn.nix
2021-03-19 22:55:48 +01:00
];
}