networking: Add dnsServers option

This commit is contained in:
SebastianStork 2026-01-14 19:53:33 +01:00
parent ceeac97675
commit 11769ee3ac
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
2 changed files with 10 additions and 5 deletions

View file

@ -47,6 +47,15 @@ in
type = lib.types.nonEmptyStr;
default = "nebula@mesh.service";
};
dnsServers = lib.mkOption {
type = lib.types.anything;
default =
self.nixosConfigurations
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.dns.enable)
|> lib.map (host: host.config.custom.networking.overlay.address);
};
};
underlay = {

View file

@ -87,11 +87,7 @@ in
systemd.network.networks."40-nebula" = {
matchConfig.Name = netCfg.overlay.interface;
address = [ "${netCfg.overlay.address}/${toString netCfg.overlay.prefixLength}" ];
dns =
self.nixosConfigurations
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.dns.enable)
|> lib.map (host: host.config.custom.networking.overlay.address);
dns = netCfg.overlay.dnsServers;
domains = [ netCfg.overlay.domain ];
};
};