about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-05-23 22:26:02 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-05-23 22:26:23 -0700
commitbb6ac771c40342d578aa5959d81454b3676b0e49 (patch)
tree32d59e370bd70af2253e68469f99253634ab153a /pkgs/servers
parent384d8a79d035ac79b51e37afdaa53fe6abdd37e8 (diff)
downloadnixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar.gz
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar.bz2
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar.lz
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar.xz
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.tar.zst
nixlib-bb6ac771c40342d578aa5959d81454b3676b0e49.zip
dnsutils: Add smaller derivation of bind
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/dns/bind/default.nix35
1 files changed, 25 insertions, 10 deletions
diff --git a/pkgs/servers/dns/bind/default.nix b/pkgs/servers/dns/bind/default.nix
index bb4e1a0f8d43..70d88b2a9689 100644
--- a/pkgs/servers/dns/bind/default.nix
+++ b/pkgs/servers/dns/bind/default.nix
@@ -7,15 +7,19 @@
 
 # Optional DLZ Modules
 , postgresql ? null, libmysql ? null, db ? null, openldap ? null
+
+# Extra arguments
+, suffix ? ""
 }:
 
-assert postgresql != null;
 with stdenv;
 let
   version = "9.10.2";
 
+  toolsOnly = suffix == "tools";
+
   optLibseccomp = shouldUsePkg libseccomp;
-  optPython = shouldUsePkg python;
+  optPython = if toolsOnly then null else shouldUsePkg python;
   optKerberos = shouldUsePkg kerberos;
   optOpenssl = shouldUsePkg openssl;
   optLibxml2 = shouldUsePkg libxml2;
@@ -25,18 +29,19 @@ let
   optIdnkit = shouldUsePkg idnkit;
   optLibiconv = shouldUsePkg libiconv;
 
-  optPostgresql = shouldUsePkg postgresql;
-  optLibmysql = shouldUsePkg libmysql;
-  optDb = shouldUsePkg db;
-  optOpenldap = shouldUsePkg openldap;
+  optPostgresql = if toolsOnly then null else shouldUsePkg postgresql;
+  optLibmysql = if toolsOnly then null else shouldUsePkg libmysql;
+  optDb = if toolsOnly then null else shouldUsePkg db;
+  optOpenldap = if toolsOnly then null else shouldUsePkg openldap;
+
+  pythonBin = if optPython == null then null else "${optPython}/bin/python";
 in
-assert optPostgresql != null;
 with stdenv.lib;
 stdenv.mkDerivation rec {
-  name = "bind-${version}";
+  name = "bind${optionalString (suffix != "") "-${suffix}"}-${version}";
 
   src = fetchurl {
-    url = "http://ftp.isc.org/isc/bind9/${version}/${name}.tar.gz";
+    url = "http://ftp.isc.org/isc/bind9/${version}/bind-${version}.tar.gz";
     sha256 = "163s8pvqj4lyryvfzkc6acbys7gw1by5dqwilggiwp54ia8bg6vg";
   };
 
@@ -55,7 +60,7 @@ stdenv.mkDerivation rec {
     (mkOther                          "localstatedir"       "/var")
     (mkOther                          "sysconfdir"          "/etc")
     (mkEnable (optLibseccomp != null) "seccomp"             null)
-    (mkWith   (optPython != null)     "python"              "${optPython}/bin/python")
+    (mkWith   (optPython != null)     "python"              pythonBin)
     (mkEnable true                    "kqueue"              null)
     (mkEnable true                    "epoll"               null)
     (mkEnable true                    "devpoll"             null)
@@ -109,8 +114,18 @@ stdenv.mkDerivation rec {
   installFlags = [
     "sysconfdir=\${out}/etc"
     "localstatedir=\${TMPDIR}"
+  ] ++ optionals toolsOnly [
+    "DESTDIR=\${TMPDIR}"
   ];
 
+  postInstall = optionalString toolsOnly ''
+    mkdir -p $out/{bin,etc,lib,share/man/man1}
+    install -m 0755 $TMPDIR/$out/bin/{dig,nslookup,nsupdate} $out/bin
+    install -m 0644 $TMPDIR/$out/etc/bind.keys $out/etc
+    install -m 0644 $TMPDIR/$out/lib/*.so.* $out/lib
+    install -m 0644 $TMPDIR/$out/share/man/man1/{dig,nslookup,nsupdate}.1 $out/share/man/man1
+  '';
+
   enableParallelBuilding = true;
 
   meta = {