mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
networking config: specify resolv.conf options as list of strings
This commit is contained in:
parent
14dfdeb31a
commit
4e74479807
@ -11,11 +11,9 @@ let
|
|||||||
config.services.dnsmasq.resolveLocalQueries;
|
config.services.dnsmasq.resolveLocalQueries;
|
||||||
hasLocalResolver = config.services.bind.enable || dnsmasqResolve;
|
hasLocalResolver = config.services.bind.enable || dnsmasqResolve;
|
||||||
|
|
||||||
resolvconfOptions =
|
resolvconfOptions = cfg.resolvconfOptions
|
||||||
builtins.replaceStrings ["\n"] [" "]
|
++ optional cfg.dnsSingleRequest "single-request"
|
||||||
(cfg.resolvconfOptions +
|
++ optional cfg.dnsExtensionMechanism "ends0";
|
||||||
(optionalString cfg.dnsSingleRequest " single-request") +
|
|
||||||
(optionalString cfg.dnsExtensionMechanism " ends0"));
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -65,9 +63,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.resolvconfOptions = lib.mkOption {
|
networking.resolvconfOptions = lib.mkOption {
|
||||||
type = types.lines;
|
type = types.listOf types.str;
|
||||||
default = "";
|
default = [];
|
||||||
example = "ndots:1 rotate";
|
example = [ "ndots:1" "rotate" ];
|
||||||
description = ''
|
description = ''
|
||||||
Set the options in <filename>/etc/resolv.conf</filename>.
|
Set the options in <filename>/etc/resolv.conf</filename>.
|
||||||
'';
|
'';
|
||||||
@ -184,9 +182,9 @@ in
|
|||||||
# Invalidate the nscd cache whenever resolv.conf is
|
# Invalidate the nscd cache whenever resolv.conf is
|
||||||
# regenerated.
|
# regenerated.
|
||||||
libc_restart='${pkgs.systemd}/bin/systemctl try-restart --no-block nscd.service 2> /dev/null'
|
libc_restart='${pkgs.systemd}/bin/systemctl try-restart --no-block nscd.service 2> /dev/null'
|
||||||
'' + optionalString ((stringLength resolvconfOptions) > 0) ''
|
'' + optionalString (length resolvconfOptions > 0) ''
|
||||||
# Options as described in resolv.conf(5)
|
# Options as described in resolv.conf(5)
|
||||||
resolv_conf_options='${resolvconfOptions}'
|
resolv_conf_options='${concatStringsSep " " resolvconfOptions}'
|
||||||
'' + optionalString hasLocalResolver ''
|
'' + optionalString hasLocalResolver ''
|
||||||
# This hosts runs a full-blown DNS resolver.
|
# This hosts runs a full-blown DNS resolver.
|
||||||
name_servers='127.0.0.1'
|
name_servers='127.0.0.1'
|
||||||
|
Loading…
Reference in New Issue
Block a user