2022-11-27 09:42:12 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, gnutls, liburcu, lmdb, libcap_ng, libidn2, libunistring
|
2021-08-05 21:33:18 +00:00
|
|
|
, systemd, nettle, libedit, zlib, libiconv, libintl, libmaxminddb, libbpf, nghttp2, libmnl
|
2022-12-17 10:02:37 +00:00
|
|
|
, ngtcp2-gnutls, xdp-tools
|
2022-09-14 18:05:37 +00:00
|
|
|
, autoreconfHook
|
|
|
|
, nixosTests, knot-resolver, knot-dns, runCommandLocal
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "knot-dns";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "3.3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://secure.nic.cz/files/knot-dns/knot-${version}.tar.xz";
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "f3f4b1d49ec9b81113b14a38354b823bd4a470356ed7e8e555595b6fd1ac80c9";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "bin" "out" "dev" ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-configdir=/etc/knot"
|
|
|
|
"--with-rundir=/run/knot"
|
|
|
|
"--with-storage=/var/lib/knot"
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Don't try to create directories like /var/lib/knot at build time.
|
|
|
|
# They are later created from NixOS itself.
|
|
|
|
./dont-create-run-time-dirs.patch
|
2020-09-25 04:45:31 +00:00
|
|
|
./runtime-deps.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
gnutls liburcu libidn2 libunistring
|
|
|
|
nettle libedit
|
|
|
|
libiconv lmdb libintl
|
2020-09-25 04:45:31 +00:00
|
|
|
nghttp2 # DoH support in kdig
|
2022-09-09 14:08:57 +00:00
|
|
|
ngtcp2-gnutls # DoQ support in kdig (and elsewhere but not much use there yet)
|
2020-08-20 17:08:02 +00:00
|
|
|
libmaxminddb # optional for geoip module (it's tiny)
|
2020-04-24 23:36:52 +00:00
|
|
|
# without sphinx &al. for developer documentation
|
2020-09-25 04:45:31 +00:00
|
|
|
# TODO: add dnstap support?
|
2021-08-05 21:33:18 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libcap_ng systemd
|
2022-12-17 10:02:37 +00:00
|
|
|
xdp-tools libbpf libmnl # XDP support (it's Linux kernel API)
|
2021-08-05 21:33:18 +00:00
|
|
|
] ++ lib.optional stdenv.isDarwin zlib; # perhaps due to gnutls
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
CFLAGS = [ "-O2" "-DNDEBUG" ];
|
|
|
|
|
|
|
|
doCheck = true;
|
2022-10-30 15:09:59 +00:00
|
|
|
checkFlags = [ "V=1" ]; # verbose output in case some test fails
|
2020-10-16 20:44:37 +00:00
|
|
|
doInstallCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -r "$out"/lib/*.la
|
|
|
|
'';
|
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit knot-resolver;
|
|
|
|
} // lib.optionalAttrs stdenv.isLinux {
|
2023-03-15 16:39:30 +00:00
|
|
|
inherit (nixosTests) knot kea;
|
2022-09-14 18:05:37 +00:00
|
|
|
# Some dependencies are very version-sensitive, so the might get dropped
|
|
|
|
# or embedded after some update, even if the nixPackagers didn't intend to.
|
|
|
|
# For non-linux I don't know a good replacement for `ldd`.
|
|
|
|
deps = runCommandLocal "knot-deps-test"
|
|
|
|
{ nativeBuildInputs = [ (lib.getBin stdenv.cc.libc) ]; }
|
|
|
|
''
|
2022-12-17 10:02:37 +00:00
|
|
|
for libname in libngtcp2 libxdp libbpf; do
|
2022-09-14 18:05:37 +00:00
|
|
|
echo "Checking for $libname:"
|
|
|
|
ldd '${knot-dns.bin}/bin/knotd' | grep -F "$libname"
|
|
|
|
echo "OK"
|
|
|
|
done
|
|
|
|
touch "$out"
|
|
|
|
'';
|
2021-12-24 04:21:11 +00:00
|
|
|
};
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Authoritative-only DNS server from .cz domain registry";
|
|
|
|
homepage = "https://knot-dns.cz";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.vcunat ];
|
2022-09-30 11:47:45 +00:00
|
|
|
mainProgram = "knotd";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|