2019-03-01 15:37:07 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, runCommand, pkgconfig, hexdump, which
|
2017-09-22 10:27:59 +01:00
|
|
|
, knot-dns, luajit, libuv, lmdb, gnutls, nettle
|
|
|
|
, cmocka, systemd, dns-root-data, makeWrapper
|
|
|
|
, extraFeatures ? false /* catch-all if defaults aren't enough */
|
2018-07-21 01:44:44 +01:00
|
|
|
, luajitPackages
|
2017-01-25 14:20:18 +00:00
|
|
|
}:
|
2018-02-01 16:15:28 +00:00
|
|
|
let # un-indented, over the whole file
|
2017-01-25 14:20:18 +00:00
|
|
|
|
2018-02-01 16:15:28 +00:00
|
|
|
result = if extraFeatures then wrapped-full else unwrapped;
|
|
|
|
|
2018-07-20 20:36:12 +01:00
|
|
|
inherit (stdenv.lib) optional concatStringsSep;
|
2018-02-01 16:15:28 +00:00
|
|
|
|
|
|
|
unwrapped = stdenv.mkDerivation rec {
|
2017-01-25 14:20:18 +00:00
|
|
|
name = "knot-resolver-${version}";
|
2019-01-10 12:10:50 +00:00
|
|
|
version = "3.2.1";
|
2017-01-25 14:20:18 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://secure.nic.cz/files/knot-resolver/${name}.tar.xz";
|
2019-01-10 12:10:50 +00:00
|
|
|
sha256 = "d1396888ec3a63f19dccdf2b7dbcb0d16a5d8642766824b47f4c21be90ce362b";
|
2017-01-25 14:20:18 +00:00
|
|
|
};
|
|
|
|
|
2019-03-01 15:37:07 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "support-libzscanner-2.8.diff";
|
|
|
|
url = "https://gitlab.labs.nic.cz/knot/knot-resolver/commit/186f263.diff";
|
|
|
|
sha256 = "19zqigvc7m2a4j6bk9whx7gj0v009568rz5qwk052z7pzfikr8mk";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2019-02-23 10:20:45 +00:00
|
|
|
# Short-lived cross fix, as upstream is migrating to meson anyway.
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace platform.mk --replace "objdump" "$OBJDUMP"
|
|
|
|
'';
|
|
|
|
|
2017-01-25 14:20:18 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2018-04-01 09:52:11 +01:00
|
|
|
configurePhase = "patchShebangs scripts/";
|
2017-01-25 14:20:18 +00:00
|
|
|
|
2018-02-01 16:15:28 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig which hexdump ];
|
2017-01-25 21:41:07 +00:00
|
|
|
|
2017-09-22 10:27:59 +01:00
|
|
|
# http://knot-resolver.readthedocs.io/en/latest/build.html#requirements
|
2017-09-23 13:14:13 +01:00
|
|
|
buildInputs = [ knot-dns luajit libuv gnutls nettle lmdb ]
|
2017-09-22 10:27:59 +01:00
|
|
|
++ optional stdenv.isLinux systemd # sd_notify
|
2018-02-01 16:15:28 +00:00
|
|
|
## optional dependencies; TODO: libedit, dnstap
|
|
|
|
;
|
2017-01-25 14:20:18 +00:00
|
|
|
|
2018-08-08 22:29:19 +01:00
|
|
|
checkInputs = [ cmocka ];
|
|
|
|
|
2018-02-01 16:15:28 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"ROOTHINTS=${dns-root-data}/root.hints"
|
|
|
|
"KEYFILE_DEFAULT=${dns-root-data}/root.ds"
|
|
|
|
];
|
2017-01-25 14:20:18 +00:00
|
|
|
CFLAGS = [ "-O2" "-DNDEBUG" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-12-12 14:10:18 +00:00
|
|
|
doCheck = true;
|
2018-02-01 16:15:28 +00:00
|
|
|
doInstallCheck = false; # FIXME
|
2017-01-25 14:20:18 +00:00
|
|
|
preInstallCheck = ''
|
2017-12-12 14:10:18 +00:00
|
|
|
patchShebangs tests/config/runtest.sh
|
2017-01-25 14:20:18 +00:00
|
|
|
'';
|
|
|
|
|
2017-09-22 10:27:59 +01:00
|
|
|
postInstall = ''
|
2018-02-01 16:15:28 +00:00
|
|
|
rm "$out"/etc/knot-resolver/root.hints # using system-wide instead
|
|
|
|
'';
|
2017-01-25 14:20:18 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2017-01-25 17:41:52 +00:00
|
|
|
description = "Caching validating DNS resolver, from .cz domain registry";
|
2017-01-25 14:20:18 +00:00
|
|
|
homepage = https://knot-resolver.cz;
|
|
|
|
license = licenses.gpl3Plus;
|
2017-07-10 17:10:17 +01:00
|
|
|
# Platforms using negative pointers for stack won't work ATM due to LuaJIT impl.
|
|
|
|
platforms = filter (p: p != "aarch64-linux") platforms.unix;
|
2017-01-25 14:20:18 +00:00
|
|
|
maintainers = [ maintainers.vcunat /* upstream developer */ ];
|
|
|
|
};
|
2018-02-01 16:15:28 +00:00
|
|
|
};
|
|
|
|
|
2019-05-01 10:19:49 +01:00
|
|
|
wrapped-full = runCommand unwrapped.name
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = with luajitPackages; [
|
2018-07-08 08:21:16 +01:00
|
|
|
luasec luasocket # trust anchor bootstrap, prefill module
|
|
|
|
lfs # prefill module
|
2019-05-01 10:19:49 +01:00
|
|
|
http # for http module; brings lots of deps; some are useful elsewhere
|
2018-07-08 08:21:16 +01:00
|
|
|
];
|
2018-02-01 16:15:28 +00:00
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
}
|
|
|
|
''
|
2019-05-01 10:19:49 +01:00
|
|
|
mkdir -p "$out"/{bin,share}
|
|
|
|
makeWrapper '${unwrapped}/bin/kresd' "$out"/bin/kresd \
|
|
|
|
--set LUA_PATH "$LUA_PATH" \
|
|
|
|
--set LUA_CPATH "$LUA_CPATH"
|
2018-02-01 16:15:28 +00:00
|
|
|
ln -sr '${unwrapped}/share/man' "$out"/share/
|
2019-05-01 10:19:49 +01:00
|
|
|
ln -sr "$out"/{bin,sbin}
|
2018-02-01 16:15:28 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
in result
|