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"; stateDir = "/var/lib/nsd";
pidFile = stateDir + "/var/nsd.pid"; 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 { zoneFiles = pkgs.stdenv.mkDerivation {
preferLocalBuild = true; preferLocalBuild = true;
name = "nsd-env"; name = "nsd-env";
@ -277,7 +285,7 @@ let
default = null; default = null;
example = "%s"; example = "%s";
description = '' 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 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 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 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 { rootServer = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
@ -673,13 +690,6 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
# this is not working :(
nixpkgs.config.nsd = {
ipv6 = cfg.ipv6;
ratelimit = cfg.ratelimit.enable;
rootServer = cfg.rootServer;
};
users.extraGroups = singleton { users.extraGroups = singleton {
name = username; name = username;
gid = config.ids.gids.nsd; gid = config.ids.gids.nsd;
@ -702,7 +712,7 @@ in
serviceConfig = { serviceConfig = {
PIDFile = pidFile; PIDFile = pidFile;
Restart = "always"; Restart = "always";
ExecStart = "${pkgs.nsd}/sbin/nsd -d -c ${configFile}"; ExecStart = "${nsdPkg}/sbin/nsd -d -c ${configFile}";
}; };
preStart = '' preStart = ''

View File

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