trust-dns: asSystemResolver: listen also on ipv6 address
This commit is contained in:
@@ -17,7 +17,14 @@ let
|
|||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ "127.0.0.1" ];
|
default = [ "127.0.0.1" ];
|
||||||
description = ''
|
description = ''
|
||||||
IP addresses to serve requests from.
|
IPv4 addresses to serve requests from.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
listenAddrsIpv6 = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
IPv6 addresses to serve requests from.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
substitutions = mkOption {
|
substitutions = mkOption {
|
||||||
@@ -78,13 +85,14 @@ let
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
mkSystemdService = flavor: { includes, listenAddrsIpv4, port, substitutions, extraConfig, ... }: let
|
mkSystemdService = flavor: { includes, listenAddrsIpv4, listenAddrsIpv6, port, substitutions, extraConfig, ... }: let
|
||||||
sed = "${pkgs.gnused}/bin/sed";
|
sed = "${pkgs.gnused}/bin/sed";
|
||||||
configTemplate = toml.generate "trust-dns-${flavor}.toml" (
|
configTemplate = toml.generate "trust-dns-${flavor}.toml" (
|
||||||
(
|
(
|
||||||
lib.filterAttrsRecursive (_: v: v != null) config.services.trust-dns.settings
|
lib.filterAttrsRecursive (_: v: v != null) config.services.trust-dns.settings
|
||||||
) // {
|
) // {
|
||||||
listen_addrs_ipv4 = listenAddrsIpv4;
|
listen_addrs_ipv4 = listenAddrsIpv4;
|
||||||
|
listen_addrs_ipv6 = listenAddrsIpv6;
|
||||||
} // extraConfig
|
} // extraConfig
|
||||||
);
|
);
|
||||||
configPath = "/var/lib/trust-dns/${flavor}-config.toml";
|
configPath = "/var/lib/trust-dns/${flavor}-config.toml";
|
||||||
@@ -212,12 +220,14 @@ in
|
|||||||
|
|
||||||
sane.services.trust-dns.instances.localhost = lib.mkIf cfg.asSystemResolver {
|
sane.services.trust-dns.instances.localhost = lib.mkIf cfg.asSystemResolver {
|
||||||
listenAddrsIpv4 = [ "127.0.0.1" ];
|
listenAddrsIpv4 = [ "127.0.0.1" ];
|
||||||
|
listenAddrsIpv6 = [ "::1" ];
|
||||||
enableRecursiveResolver = true;
|
enableRecursiveResolver = true;
|
||||||
# append zones discovered via DHCP to the resolver config.
|
# append zones discovered via DHCP to the resolver config.
|
||||||
includes = [ "/var/lib/trust-dns/dhcp-configs/*" ];
|
includes = [ "/var/lib/trust-dns/dhcp-configs/*" ];
|
||||||
};
|
};
|
||||||
networking.nameservers = lib.mkIf cfg.asSystemResolver [
|
networking.nameservers = lib.mkIf cfg.asSystemResolver [
|
||||||
"127.0.0.1"
|
"127.0.0.1"
|
||||||
|
"::1"
|
||||||
];
|
];
|
||||||
services.resolved.enable = lib.mkIf cfg.asSystemResolver (lib.mkForce false);
|
services.resolved.enable = lib.mkIf cfg.asSystemResolver (lib.mkForce false);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user