nsd: Fix automatic config options

This commit is contained in:
Christoph Hrdinka 2015-03-19 12:10:55 +01:00
parent 80d8d1fc27
commit d3a2edb8ce
2 changed files with 21 additions and 9 deletions

View File

@ -9,6 +9,14 @@ let
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";
@ -277,7 +285,7 @@ let
default = null;
example = "%s";
description = ''
When config.nsd.zoneStats is set to true NSD is able of collecting
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
@ -300,6 +308,15 @@ in
'';
};
bind8Stats = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Wheter to enable BIND8 like statisics.
'';
};
rootServer = mkOption {
type = types.bool;
default = false;
@ -673,13 +690,6 @@ in
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;
@ -702,7 +712,7 @@ in
serviceConfig = {
PIDFile = pidFile;
Restart = "always";
ExecStart = "${pkgs.nsd}/sbin/nsd -d -c ${configFile}";
ExecStart = "${nsdPkg}/sbin/nsd -d -c ${configFile}";
};
preStart = ''

View File

@ -8,6 +8,7 @@
, ratelimit ? false
, recvmmsg ? false
, rootServer ? false
, rrtypes ? false
, zoneStats ? false
}:
@ -32,6 +33,7 @@ stdenv.mkDerivation rec {
++ edf ratelimit "ratelimit"
++ edf recvmmsg "recvmmsg"
++ edf rootServer "root-server"
++ edf rrtypes "draft-rrtypes"
++ edf zoneStats "zone-stats"
++ [ "--with-ssl=${openssl}" "--with-libevent=${libevent}" ];