2018-02-01 16:15:28 +00:00
|
|
|
{ stdenv, fetchurl, 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 */
|
|
|
|
, hiredis, libmemcached, 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;
|
|
|
|
|
|
|
|
inherit (stdenv.lib) optional optionals optionalString concatStringsSep;
|
|
|
|
|
|
|
|
unwrapped = stdenv.mkDerivation rec {
|
2017-01-25 14:20:18 +00:00
|
|
|
name = "knot-resolver-${version}";
|
2018-07-03 09:53:30 +01:00
|
|
|
version = "2.4.0";
|
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";
|
2018-07-03 09:53:30 +01:00
|
|
|
sha256 = "8c88c73dd50dad6f371bfc170f49cd374022e59f8005ac1fa6cd99764f72b4d1";
|
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 ]
|
2018-02-01 16:15:28 +00:00
|
|
|
++ optional doCheck cmocka
|
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-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
|
|
|
};
|
|
|
|
|
|
|
|
wrapped-full = with luajitPackages; let
|
2018-07-08 08:21:16 +01:00
|
|
|
luaPkgs = [
|
|
|
|
luasec luasocket # trust anchor bootstrap, prefill module
|
|
|
|
lfs # prefill module
|
|
|
|
# TODO: cqueues and others for http2 module
|
|
|
|
];
|
2018-02-01 16:15:28 +00:00
|
|
|
in runCommand unwrapped.name
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
}
|
|
|
|
''
|
|
|
|
mkdir -p "$out/sbin" "$out/share"
|
|
|
|
makeWrapper '${unwrapped}/sbin/kresd' "$out"/sbin/kresd \
|
|
|
|
--set LUA_PATH '${concatStringsSep ";" (map getLuaPath luaPkgs)}' \
|
|
|
|
--set LUA_CPATH '${concatStringsSep ";" (map getLuaCPath luaPkgs)}'
|
|
|
|
ln -sr '${unwrapped}/share/man' "$out"/share/
|
|
|
|
ln -sr "$out"/{sbin,bin}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in result
|
2017-01-25 14:20:18 +00:00
|
|
|
|