networking/overlay: Use blocking-nameservers as default nameservers

This commit is contained in:
SebastianStork 2026-03-17 18:04:34 +01:00
parent 1c0cb61cdf
commit 5f8b5c04b3
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
2 changed files with 20 additions and 9 deletions

View file

@ -6,6 +6,24 @@
}: }:
let let
cfg = config.custom.networking.overlay; cfg = config.custom.networking.overlay;
blocking-nameservers =
allHosts
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.blocking-nameserver.enable)
|> lib.map (
host:
"${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.blocking-nameserver.port}"
);
recursive-nameservers =
allHosts
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.recursive-nameserver.enable)
|> lib.map (
host:
"${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.recursive-nameserver.port}"
);
in in
{ {
options.custom.networking.overlay = { options.custom.networking.overlay = {
@ -60,14 +78,7 @@ in
dnsServers = lib.mkOption { dnsServers = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr; type = lib.types.listOf lib.types.nonEmptyStr;
default = default = if (blocking-nameservers != [ ]) then blocking-nameservers else recursive-nameservers;
allHosts
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.recursive-nameserver.enable)
|> lib.map (
host:
"${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.recursive-nameserver.port}"
);
}; };
implementation = lib.mkOption { implementation = lib.mkOption {

View file

@ -105,7 +105,7 @@
client2.wait_for_unit("${client2NetCfg.overlay.systemdUnit}") client2.wait_for_unit("${client2NetCfg.overlay.systemdUnit}")
lighthouse.wait_for_unit("unbound.service") lighthouse.wait_for_unit("unbound.service")
lighthouse.wait_for_open_port(53, "${lighthouseNetCfg.overlay.address}") lighthouse.wait_for_open_port(${toString nodes.lighthouse.custom.services.recursive-nameserver.port}, "${lighthouseNetCfg.overlay.address}")
server.wait_for_unit("sshd.service") server.wait_for_unit("sshd.service")
client2.wait_for_unit("sshd.service") client2.wait_for_unit("sshd.service")