about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArseniy Seroka <jagajaga@users.noreply.github.com>2015-03-23 13:19:29 +0300
committerArseniy Seroka <jagajaga@users.noreply.github.com>2015-03-23 13:19:29 +0300
commitff22e19fc4a60369e1502b86acf87519b68a569c (patch)
tree9a7ad5bb67ab502d7f3aa7ce2cdc4811d721b946
parenta8b93517fa7bfa4e6928486716fc9866218f66f1 (diff)
parentd3a2edb8cec1e24ba221276e7d1380a3df745993 (diff)
downloadnixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar.gz
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar.bz2
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar.lz
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar.xz
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.tar.zst
nixlib-ff22e19fc4a60369e1502b86acf87519b68a569c.zip
Merge pull request #6893 from hrdinka/nsd-config-options
nsd: Fix automatic config options
-rw-r--r--nixos/modules/services/networking/nsd.nix28
-rw-r--r--pkgs/servers/dns/nsd/default.nix2
2 files changed, 21 insertions, 9 deletions
diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix
index 707bb38ec02d..36d9f5d2f166 100644
--- a/nixos/modules/services/networking/nsd.nix
+++ b/nixos/modules/services/networking/nsd.nix
@@ -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 = ''
diff --git a/pkgs/servers/dns/nsd/default.nix b/pkgs/servers/dns/nsd/default.nix
index 85f0883b5de9..a6bb4171934f 100644
--- a/pkgs/servers/dns/nsd/default.nix
+++ b/pkgs/servers/dns/nsd/default.nix
@@ -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}" ];