2020-04-24 23:36:52 +00:00
|
|
|
{ config, stdenv, lib, fetchurl, fetchpatch
|
2020-09-25 04:45:31 +00:00
|
|
|
, perl, pkg-config
|
2022-03-10 19:12:11 +00:00
|
|
|
, libcap, libtool, libxml2, openssl, libuv, nghttp2, jemalloc
|
2021-12-06 16:07:01 +00:00
|
|
|
, enablePython ? false, python3
|
2022-07-14 12:49:19 +00:00
|
|
|
, enableGSSAPI ? true, libkrb5
|
2021-12-06 16:07:01 +00:00
|
|
|
, buildPackages, nixosTests
|
2023-03-08 16:32:21 +00:00
|
|
|
, cmocka, tzdata
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bind";
|
2023-03-08 16:32:21 +00:00
|
|
|
version = "9.18.12";
|
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";
|
2023-03-08 16:32:21 +00:00
|
|
|
sha256 = "sha256-R3Zrt7BjqrutBUOGsZCqf2wUUkQnr9Qnww7EJlEgJ+c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "man" "dnsutils" "host" ];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./dont-keep-configure-flags.patch
|
|
|
|
];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = [ perl pkg-config ];
|
2022-03-10 19:12:11 +00:00
|
|
|
buildInputs = [ libtool libxml2 openssl libuv nghttp2 jemalloc ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional stdenv.isLinux libcap
|
2021-12-06 16:07:01 +00:00
|
|
|
++ lib.optional enableGSSAPI libkrb5
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional enablePython (python3.withPackages (ps: with ps; [ ply ]));
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--without-lmdb"
|
2022-07-14 12:49:19 +00:00
|
|
|
] ++ lib.optional enableGSSAPI "--with-gssapi=${libkrb5.dev}/bin/krb5-config"
|
2020-06-18 07:06:33 +00:00
|
|
|
++ 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
|
2022-04-03 18:54:34 +00:00
|
|
|
sed -i "$f" -e 's|-L${openssl.dev}|-L${lib.getLib openssl}|g'
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
cat <<EOF >$out/etc/rndc.conf
|
|
|
|
include "/etc/bind/rndc.key";
|
|
|
|
options {
|
|
|
|
default-key "rndc-key";
|
|
|
|
default-server 127.0.0.1;
|
|
|
|
default-port 953;
|
|
|
|
};
|
|
|
|
EOF
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
enableParallelBuilding = true;
|
2023-03-08 16:32:21 +00:00
|
|
|
# TODO: investigate the aarch64-linux failures; see this and linked discussions:
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/192962
|
|
|
|
doCheck = with stdenv.hostPlatform; !isStatic && !(isAarch64 && isLinux);
|
|
|
|
checkTarget = "unit";
|
|
|
|
checkInputs = [
|
|
|
|
cmocka
|
|
|
|
] ++ lib.optionals (!stdenv.hostPlatform.isMusl) [
|
|
|
|
tzdata
|
|
|
|
];
|
|
|
|
preCheck = lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
|
|
# musl doesn't respect TZDIR, skip timezone-related tests
|
|
|
|
sed -i '/^ISC_TEST_ENTRY(isc_time_formatISO8601L/d' tests/isc/time_test.c
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) bind;
|
|
|
|
prometheus-exporter = nixosTests.prometheus-exporters.bind;
|
|
|
|
kubernetes-dns-single-node = nixosTests.kubernetes.dns-single-node;
|
|
|
|
kubernetes-dns-multi-node = nixosTests.kubernetes.dns-multi-node;
|
|
|
|
};
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-03-10 19:12:11 +00:00
|
|
|
homepage = "https://www.isc.org/bind/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Domain name server";
|
|
|
|
license = licenses.mpl20;
|
2022-03-30 09:31:56 +00:00
|
|
|
changelog = "https://downloads.isc.org/isc/bind9/cur/${lib.versions.majorMinor version}/CHANGES";
|
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" ];
|
|
|
|
};
|
|
|
|
}
|