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

View File

@ -7003,7 +7003,7 @@ let
nix-binary-cache = callPackage ../servers/http/nix-binary-cache {}; 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 { }; nsq = callPackage ../servers/nsq { };