Merge pull request #6893 from hrdinka/nsd-config-options

nsd: Fix automatic config options

Changed files
+21 -9
nixos
modules
services
networking
pkgs
servers
dns
+19 -9
nixos/modules/services/networking/nsd.nix
···
stateDir = "/var/lib/nsd";
pidFile = stateDir + "/var/nsd.pid";
zoneFiles = pkgs.stdenv.mkDerivation {
preferLocalBuild = true;
name = "nsd-env";
···
default = null;
example = "%s";
description = ''
-
When config.nsd.zoneStats is set to true NSD is able of collecting
statistics per zone. All statistics of this zone(s) will be added
to the group specified by this given name. Use "%s" to use the zones
name as the group. The groups are output from nsd-control stats
···
default = false;
description = ''
Whether to enable the NSD authoritative domain name server.
'';
};
···
config = mkIf cfg.enable {
-
# this is not working :(
-
nixpkgs.config.nsd = {
-
ipv6 = cfg.ipv6;
-
ratelimit = cfg.ratelimit.enable;
-
rootServer = cfg.rootServer;
-
};
-
users.extraGroups = singleton {
name = username;
gid = config.ids.gids.nsd;
···
serviceConfig = {
PIDFile = pidFile;
Restart = "always";
-
ExecStart = "${pkgs.nsd}/sbin/nsd -d -c ${configFile}";
};
preStart = ''
···
stateDir = "/var/lib/nsd";
pidFile = stateDir + "/var/nsd.pid";
+
nsdPkg = pkgs.nsd.override {
+
bind8Stats = cfg.bind8Stats;
+
ipv6 = cfg.ipv6;
+
ratelimit = cfg.ratelimit.enable;
+
rootServer = cfg.rootServer;
+
zoneStats = length (collect (x: (x.zoneStats or null) != null) cfg.zones) > 0;
+
};
+
zoneFiles = pkgs.stdenv.mkDerivation {
preferLocalBuild = true;
name = "nsd-env";
···
default = null;
example = "%s";
description = ''
+
When set to something distinct to null NSD is able to collect
statistics per zone. All statistics of this zone(s) will be added
to the group specified by this given name. Use "%s" to use the zones
name as the group. The groups are output from nsd-control stats
···
default = false;
description = ''
Whether to enable the NSD authoritative domain name server.
+
'';
+
};
+
+
bind8Stats = mkOption {
+
type = types.bool;
+
default = false;
+
example = true;
+
description = ''
+
Wheter to enable BIND8 like statisics.
'';
};
···
config = mkIf cfg.enable {
users.extraGroups = singleton {
name = username;
gid = config.ids.gids.nsd;
···
serviceConfig = {
PIDFile = pidFile;
Restart = "always";
+
ExecStart = "${nsdPkg}/sbin/nsd -d -c ${configFile}";
};
preStart = ''
+2
pkgs/servers/dns/nsd/default.nix
···
, ratelimit ? false
, recvmmsg ? false
, rootServer ? false
, zoneStats ? false
}:
···
++ edf ratelimit "ratelimit"
++ edf recvmmsg "recvmmsg"
++ edf rootServer "root-server"
++ edf zoneStats "zone-stats"
++ [ "--with-ssl=${openssl}" "--with-libevent=${libevent}" ];
···
, ratelimit ? false
, recvmmsg ? false
, rootServer ? false
+
, rrtypes ? false
, zoneStats ? false
}:
···
++ edf ratelimit "ratelimit"
++ edf recvmmsg "recvmmsg"
++ edf rootServer "root-server"
+
++ edf rrtypes "draft-rrtypes"
++ edf zoneStats "zone-stats"
++ [ "--with-ssl=${openssl}" "--with-libevent=${libevent}" ];