pkgs/nsd: Allow to easily override the package.

Allowing to use nixpkgs config to provide different defaults is not
going to help us here, so we would like to use nsd.override {} in order
to supply the correct options in the module.

Eventually removing the nixpkgs config option would make sense here as
well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-07-23 17:09:28 +02:00
parent 6386df1645
commit fd9c8fa3dc
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961
2 changed files with 20 additions and 12 deletions

View File

@ -1,4 +1,13 @@
{ config, stdenv, fetchurl, libevent, openssl
, bind8Stats ? false
, checking ? false
, ipv6 ? true
, mmap ? false
, minimalResponses ? true
, nsec3 ? true
, ratelimit ? false
, recvmmsg ? false
, rootServer ? false
}:
stdenv.mkDerivation rec {
@ -12,17 +21,16 @@ stdenv.mkDerivation rec {
buildInputs = [ libevent openssl ];
configureFlags =
let flag = state: flags: if state then map (x: "--enable-${x}") flags
else map (x: "--disable-${x}") flags;
in flag (config.nsd.bind8Stats or false) [ "bind8-stats" ]
++ flag (config.nsd.checking or false) [ "checking" ]
++ flag (config.nsd.ipv6 or true) [ "ipv6" ]
++ flag (config.nsd.mmap or false) [ "mmap" ]
++ flag (config.nsd.minimalResponses or true) [ "minimal-responses" ]
++ flag (config.nsd.nsec3 or true) [ "nsec3" ]
++ flag (config.nsd.ratelimit or false) [ "ratelimit" ]
++ flag (config.nsd.recvmmsg or false) [ "recvmmsg" ]
++ flag (config.nsd.rootServer or false) [ "root-server" ]
let edf = c: o: if c then ["--enable-${o}"] else ["--disable-${o}"];
in edf bind8Stats "bind8-stats"
++ edf checking "checking"
++ edf ipv6 "ipv6"
++ edf mmap "mmap"
++ edf minimalResponses "minimal-responses"
++ edf nsec3 "nsec3"
++ edf ratelimit "ratelimit"
++ edf recvmmsg "recvmmsg"
++ edf rootServer "root-server"
++ [ "--with-ssl=${openssl}" "--with-libevent=${libevent}" ];
meta = {

View File

@ -7003,7 +7003,7 @@ let
nix-binary-cache = callPackage ../servers/http/nix-binary-cache {};
nsd = callPackage ../servers/dns/nsd { };
nsd = callPackage ../servers/dns/nsd (config.nsd or {});
nsq = callPackage ../servers/nsq { };