@@ -11,6 +11,11 @@ let
1111 config.services.dnsmasq.resolveLocalQueries;
1212 hasLocalResolver = config.services.bind.enable || dnsmasqResolve;
1313
14+ resolvconfOptions =
15+ builtins.replaceStrings ["\n"] [" "]
16+ (cfg.resolvconfOptions +
17+ (optionalString cfg.dnsSingleRequest " single-request") +
18+ (optionalString cfg.dnsExtensionMechanism " ends0"));
1419in
1520
1621{
@@ -59,6 +64,14 @@ in
5964 '';
6065 };
6166
67+ networking.resolvconfOptions = lib.mkOption {
68+ type = types.lines;
69+ default = "";
70+ example = "ndots:1 rotate";
71+ description = ''
72+ Set the options in <filename>/etc/resolv.conf</filename>.
73+ '';
74+ };
6275
6376 networking.proxy = {
6477
@@ -171,12 +184,9 @@ in
171184 # Invalidate the nscd cache whenever resolv.conf is
172185 # regenerated.
173186 libc_restart='${pkgs.systemd}/bin/systemctl try-restart --no-block nscd.service 2> /dev/null'
174− '' + optionalString cfg.dnsSingleRequest ''
175− # only send one DNS request at a time
176− resolv_conf_options+=' single-request'
177− '' + optionalString cfg.dnsExtensionMechanism ''
178− # enable extension mechanisms for DNS
179− resolv_conf_options+=' edns0'
187+ '' + optionalString ((stringLength resolvconfOptions) > 0) ''
188+ # Options as described in resolv.conf(5)
189+ resolv_conf_options='${resolvconfOptions}'
180190 '' + optionalString hasLocalResolver ''
181191 # This hosts runs a full-blown DNS resolver.
182192 name_servers='127.0.0.1'