diff options
author | Christian Zagrodnick <cz@flyingcircus.io> | 2015-12-01 07:38:49 +0100 |
---|---|---|
committer | Joachim Fasting <joachifm@fastmail.fm> | 2016-05-28 14:28:13 +0200 |
commit | 14dfdeb31adb965da1c1f5aa4667eab0043aa51e (patch) | |
tree | 1a88f40766d75e97151481a5c618810bb01a5649 /nixos | |
parent | 649b5bceb1e2d657146d1bc7fbd8cf2a980499ec (diff) |
networking config: support setting resolv.conf options
Closes: #11372
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/config/networking.nix | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index 0c4f4cbfa5c6e..ceb9152e6de60 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -11,6 +11,11 @@ let config.services.dnsmasq.resolveLocalQueries; hasLocalResolver = config.services.bind.enable || dnsmasqResolve; + resolvconfOptions = + builtins.replaceStrings ["\n"] [" "] + (cfg.resolvconfOptions + + (optionalString cfg.dnsSingleRequest " single-request") + + (optionalString cfg.dnsExtensionMechanism " ends0")); in { @@ -59,6 +64,14 @@ in ''; }; + networking.resolvconfOptions = lib.mkOption { + type = types.lines; + default = ""; + example = "ndots:1 rotate"; + description = '' + Set the options in <filename>/etc/resolv.conf</filename>. + ''; + }; networking.proxy = { @@ -171,12 +184,9 @@ in # Invalidate the nscd cache whenever resolv.conf is # regenerated. libc_restart='${pkgs.systemd}/bin/systemctl try-restart --no-block nscd.service 2> /dev/null' - '' + optionalString cfg.dnsSingleRequest '' - # only send one DNS request at a time - resolv_conf_options+=' single-request' - '' + optionalString cfg.dnsExtensionMechanism '' - # enable extension mechanisms for DNS - resolv_conf_options+=' edns0' + '' + optionalString ((stringLength resolvconfOptions) > 0) '' + # Options as described in resolv.conf(5) + resolv_conf_options='${resolvconfOptions}' '' + optionalString hasLocalResolver '' # This hosts runs a full-blown DNS resolver. name_servers='127.0.0.1' |