2023-08-22 20:05:09 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
2024-07-31 10:19:44 +00:00
|
|
|
, darwin
|
2023-08-22 20:05:09 +00:00
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, libcap
|
|
|
|
, libidn2
|
|
|
|
, libtool
|
|
|
|
, libxml2
|
|
|
|
, openssl
|
|
|
|
, libuv
|
|
|
|
, nghttp2
|
|
|
|
, jemalloc
|
|
|
|
, enablePython ? false
|
|
|
|
, python3
|
|
|
|
, enableGSSAPI ? true
|
|
|
|
, libkrb5
|
|
|
|
, buildPackages
|
|
|
|
, nixosTests
|
|
|
|
, cmocka
|
|
|
|
, tzdata
|
|
|
|
, gitUpdater
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "bind";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "9.18.28";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-09-19 14:19:46 +00:00
|
|
|
url = "https://downloads.isc.org/isc/bind9/${finalAttrs.version}/${finalAttrs.pname}-${finalAttrs.version}.tar.xz";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-58zpoWX3thnu/Egy8KjcFrAF0p44kK7WAIxQbqKGpec=";
|
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 ];
|
2023-08-22 20:05:09 +00:00
|
|
|
buildInputs = [ libidn2 libtool libxml2 openssl libuv nghttp2 jemalloc ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isLinux libcap
|
2021-12-06 16:07:01 +00:00
|
|
|
++ lib.optional enableGSSAPI libkrb5
|
2024-07-31 10:19:44 +00:00
|
|
|
++ lib.optional enablePython (python3.withPackages (ps: with ps; [ ply ]))
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--without-lmdb"
|
2023-08-22 20:05:09 +00:00
|
|
|
"--with-libidn2"
|
2022-07-14 12:49:19 +00:00
|
|
|
] ++ lib.optional enableGSSAPI "--with-gssapi=${libkrb5.dev}/bin/krb5-config"
|
2023-08-22 20:05:09 +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;
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
# TODO: investigate failures; see this and linked discussions:
|
2023-03-08 16:32:21 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/pull/192962
|
2024-04-21 15:54:59 +00:00
|
|
|
/*
|
2023-10-09 19:29:22 +00:00
|
|
|
doCheck = with stdenv.hostPlatform; !isStatic && !(isAarch64 && isLinux)
|
|
|
|
# https://gitlab.isc.org/isc-projects/bind9/-/issues/4269
|
|
|
|
&& !is32bit;
|
2024-04-21 15:54:59 +00:00
|
|
|
*/
|
2023-03-08 16:32:21 +00:00
|
|
|
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
|
2024-02-29 20:09:43 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
# Test timeouts on Darwin
|
|
|
|
sed -i '/^ISC_TEST_ENTRY(tcpdns_recv_one/d' tests/isc/netmgr_test.c
|
2023-03-08 16:32:21 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
2024-09-19 14:19:46 +00:00
|
|
|
withCheck = finalAttrs.finalPackage.overrideAttrs { doCheck = true; };
|
2023-08-22 20:05:09 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
# No nicer place to find latest stable release.
|
|
|
|
url = "https://gitlab.isc.org/isc-projects/bind9.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
# Avoid unstable 9.19 releases.
|
|
|
|
odd-unstable = true;
|
|
|
|
};
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
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;
|
2024-09-19 14:19:46 +00:00
|
|
|
changelog = "https://downloads.isc.org/isc/bind9/cur/${lib.versions.majorMinor finalAttrs.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" ];
|
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
})
|