diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index 619f36cd515..5fa91ec9cfb 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -9,7 +9,9 @@ let cfg = config.networking; dnsmasqResolve = config.services.dnsmasq.enable && config.services.dnsmasq.resolveLocalQueries; - hasLocalResolver = config.services.bind.enable || dnsmasqResolve; + bindResolve = config.services.bind.enable && + config.services.bind.resolveLocalQueries; + hasLocalResolver = bindResolve || dnsmasqResolve; resolvconfOptions = cfg.resolvconfOptions ++ optional cfg.dnsSingleRequest "single-request" diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix index 763283dfe7a..9f533eedf6e 100644 --- a/nixos/modules/services/networking/bind.nix +++ b/nixos/modules/services/networking/bind.nix @@ -151,6 +151,15 @@ in "; }; + resolveLocalQueries = mkOption { + type = types.bool; + default = true; + description = '' + Whether bind should resolve local queries (i.e. add 127.0.0.1 to + /etc/resolv.conf, overriding networking.nameserver). + ''; + }; + }; }; diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix index fcf5aa5f175..3d1b931de07 100644 --- a/nixos/modules/services/networking/dnsmasq.nix +++ b/nixos/modules/services/networking/dnsmasq.nix @@ -42,7 +42,7 @@ in default = true; description = '' Whether dnsmasq should resolve local queries (i.e. add 127.0.0.1 to - /etc/resolv.conf). + /etc/resolv.conf overriding networking.nameservers). ''; }; diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 7ede8752bcc..adc048f3ca2 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -105,7 +105,7 @@ let '' # Set the static DNS configuration, if given. ${pkgs.openresolv}/sbin/resolvconf -m 1 -a static <