From 0ba49949b087f0b358dafc118588f80dabcc885e Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 2 Oct 2023 17:36:08 -0400 Subject: [PATCH] nixos/network-interfaces-systemd: don't set network-level domains systemd.network(5) describes Domains= as a "list of domains which should be resolved using the DNS servers on this link." This setting is read by systemd-resolved.service, and it's used to configure both search domains and DNS query routing. Adding the search domains from `networking.search` is unnecessary because these are already configured globally in `resolved.conf` through the default value of `services.resolved.domains`. Adding the system's `networking.domain` to each network is unexpected and probably incorrect. A user may not expect that the domain is in effect automatically added to the search domains even if not specified in `networking.search`. Both of these network-level assignments are problematic in cases where the NixOS networkd module is not managing every interface on the system. In that scenario, the managed interfaces will have Domains= set while the others do not. That will cause systemd-resolved to route DNS queries for the search domains and the system domain to only those managed interfaces. --- nixos/modules/tasks/network-interfaces-systemd.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 679567cbb730..2181ee336370 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -28,7 +28,6 @@ let # TODO: warn the user that any address configured on those interfaces will be useless ++ concatMap (i: attrNames (filterAttrs (_: config: config.type != "internal") i.interfaces)) (attrValues cfg.vswitches); - domains = cfg.search ++ (optional (cfg.domain != null) cfg.domain); genericNetwork = override: let gateway = optional (cfg.defaultGateway != null && (cfg.defaultGateway.address or "") != "") cfg.defaultGateway.address ++ optional (cfg.defaultGateway6 != null && (cfg.defaultGateway6.address or "") != "") cfg.defaultGateway6.address; @@ -40,8 +39,6 @@ let }; in optionalAttrs (gateway != [ ]) { routes = override (map makeGateway gateway); - } // optionalAttrs (domains != [ ]) { - domains = override domains; }; genericDhcpNetworks = initrd: mkIf cfg.useDHCP {