about summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorChristoph Hrdinka <c.github@hrdinka.at>2015-03-19 12:10:55 +0100
committerChristoph Hrdinka <c.github@hrdinka.at>2015-03-19 12:10:55 +0100
commitd3a2edb8cec1e24ba221276e7d1380a3df745993 (patch)
tree629ba9fc550cf2af9663737690c2c7b0ecd1abc5 /nixos/modules/services/networking
parent80d8d1fc276cd6a075b28e89f75f141bc6770b7f (diff)
downloadnixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar.gz
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar.bz2
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar.lz
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar.xz
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.tar.zst
nixlib-d3a2edb8cec1e24ba221276e7d1380a3df745993.zip
nsd: Fix automatic config options
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/nsd.nix28
1 files changed, 19 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 = ''