2020-04-24 23:36:52 +00:00
|
|
|
{ config, stdenv, lib, fetchurl, fetchpatch
|
2020-09-25 04:45:31 +00:00
|
|
|
, perl, pkg-config
|
|
|
|
, libcap, libtool, libxml2, openssl, libuv
|
2020-04-24 23:36:52 +00:00
|
|
|
, enablePython ? config.bind.enablePython or false, python3 ? null
|
2020-09-25 04:45:31 +00:00
|
|
|
, enableSeccomp ? false, libseccomp ? null, buildPackages, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableSeccomp -> libseccomp != null;
|
|
|
|
assert enablePython -> python3 != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bind";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "9.16.16";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-09-25 04:45:31 +00:00
|
|
|
url = "https://downloads.isc.org/isc/bind9/${version}/${pname}-${version}.tar.xz";
|
2021-05-20 23:08:51 +00:00
|
|
|
sha256 = "sha256-bJE5Aq34eOfcXiKc6pT678nUD0R3WjAhPt0Ihg92HXs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "man" "dnsutils" "host" ];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./dont-keep-configure-flags.patch
|
|
|
|
./remove-mkdir-var.patch
|
|
|
|
];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = [ perl pkg-config ];
|
|
|
|
buildInputs = [ libtool libxml2 openssl libuv ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional stdenv.isLinux libcap
|
|
|
|
++ lib.optional enableSeccomp libseccomp
|
|
|
|
++ lib.optional enablePython (python3.withPackages (ps: with ps; [ ply ]));
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--with-libtool"
|
|
|
|
(if enablePython then "--with-python" else "--without-python")
|
|
|
|
"--without-atf"
|
|
|
|
"--without-dlopen"
|
|
|
|
"--without-docbook-xsl"
|
|
|
|
"--without-gssapi"
|
|
|
|
"--without-idn"
|
|
|
|
"--without-idnlib"
|
|
|
|
"--without-lmdb"
|
|
|
|
"--without-libjson"
|
|
|
|
"--without-pkcs11"
|
|
|
|
"--without-purify"
|
|
|
|
"--with-randomdev=/dev/random"
|
|
|
|
"--with-ecdsa"
|
|
|
|
"--with-gost"
|
|
|
|
"--without-eddsa"
|
|
|
|
"--with-aes"
|
|
|
|
] ++ lib.optional stdenv.isLinux "--with-libcap=${libcap.dev}"
|
2020-06-18 07:06:33 +00:00
|
|
|
++ lib.optional enableSeccomp "--enable-seccomp"
|
|
|
|
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "BUILD_CC=$(CC_FOR_BUILD)";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
moveToOutput bin/bind9-config $dev
|
|
|
|
|
|
|
|
moveToOutput bin/host $host
|
|
|
|
|
|
|
|
moveToOutput bin/dig $dnsutils
|
|
|
|
moveToOutput bin/delv $dnsutils
|
|
|
|
moveToOutput bin/nslookup $dnsutils
|
|
|
|
moveToOutput bin/nsupdate $dnsutils
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
for f in "$lib/lib/"*.la "$dev/bin/"bind*-config; do
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i "$f" -e 's|-L${openssl.dev}|-L${openssl.out}|g'
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false; # requires root and the net
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) bind; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.isc.org/downloads/bind/";
|
|
|
|
description = "Domain name server";
|
|
|
|
license = licenses.mpl20;
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
maintainers = with maintainers; [ globin ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
|
|
|
|
outputsToInstall = [ "out" "dnsutils" "host" ];
|
|
|
|
};
|
|
|
|
}
|