2018-02-01 17:15:28 +01:00
|
|
|
{ stdenv, fetchurl, runCommand, pkgconfig, hexdump, which
|
2017-09-22 11:27:59 +02: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 15:20:18 +01:00
|
|
|
}:
|
2018-02-01 17:15:28 +01:00
|
|
|
let # un-indented, over the whole file
|
2017-01-25 15:20:18 +01:00
|
|
|
|
2018-02-01 17:15:28 +01:00
|
|
|
result = if extraFeatures then wrapped-full else unwrapped;
|
|
|
|
|
|
|
|
inherit (stdenv.lib) optional optionals optionalString concatStringsSep;
|
|
|
|
|
|
|
|
unwrapped = stdenv.mkDerivation rec {
|
2017-01-25 15:20:18 +01:00
|
|
|
name = "knot-resolver-${version}";
|
2018-02-01 17:15:28 +01:00
|
|
|
version = "2.0.0";
|
2017-01-25 15:20:18 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://secure.nic.cz/files/knot-resolver/${name}.tar.xz";
|
2018-02-01 17:15:28 +01:00
|
|
|
sha256 = "b40d9dbef05031464dfff57712f476e7cddc0fda26b41daf660c5a33ea203ce0";
|
2017-01-25 15:20:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
configurePhase = ":";
|
|
|
|
|
2018-02-01 17:15:28 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig which hexdump ];
|
2017-01-25 22:41:07 +01:00
|
|
|
|
2017-09-22 11:27:59 +02:00
|
|
|
# http://knot-resolver.readthedocs.io/en/latest/build.html#requirements
|
2017-09-23 14:14:13 +02:00
|
|
|
buildInputs = [ knot-dns luajit libuv gnutls nettle lmdb ]
|
2018-02-01 17:15:28 +01:00
|
|
|
++ optional doCheck cmocka
|
2017-09-22 11:27:59 +02:00
|
|
|
++ optional stdenv.isLinux systemd # sd_notify
|
2018-02-01 17:15:28 +01:00
|
|
|
## optional dependencies; TODO: libedit, dnstap
|
|
|
|
;
|
2017-01-25 15:20:18 +01:00
|
|
|
|
2018-02-01 17:15:28 +01:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"ROOTHINTS=${dns-root-data}/root.hints"
|
|
|
|
"KEYFILE_DEFAULT=${dns-root-data}/root.ds"
|
|
|
|
];
|
2017-01-25 15:20:18 +01:00
|
|
|
CFLAGS = [ "-O2" "-DNDEBUG" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-12-12 15:10:18 +01:00
|
|
|
doCheck = true;
|
2018-02-01 17:15:28 +01:00
|
|
|
doInstallCheck = false; # FIXME
|
2017-01-25 15:20:18 +01:00
|
|
|
preInstallCheck = ''
|
2017-12-12 15:10:18 +01:00
|
|
|
patchShebangs tests/config/runtest.sh
|
2017-01-25 15:20:18 +01:00
|
|
|
'';
|
|
|
|
|
2017-09-22 11:27:59 +02:00
|
|
|
postInstall = ''
|
2018-02-01 17:15:28 +01:00
|
|
|
rm "$out"/etc/knot-resolver/root.hints # using system-wide instead
|
|
|
|
'';
|
2017-01-25 15:20:18 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2017-01-25 18:41:52 +01:00
|
|
|
description = "Caching validating DNS resolver, from .cz domain registry";
|
2017-01-25 15:20:18 +01:00
|
|
|
homepage = https://knot-resolver.cz;
|
|
|
|
license = licenses.gpl3Plus;
|
2017-07-10 18:10:17 +02: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 15:20:18 +01:00
|
|
|
maintainers = [ maintainers.vcunat /* upstream developer */ ];
|
|
|
|
};
|
2018-02-01 17:15:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
wrapped-full = with luajitPackages; let
|
|
|
|
luaPkgs = [ luasec luasocket ]; # TODO: cqueues and others for http2 module
|
|
|
|
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 15:20:18 +01:00
|
|
|
|