2017-07-28 14:33:40 +01:00
|
|
|
{ stdenv, fetchurl, 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
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2017-09-22 10:27:59 +01:00
|
|
|
inherit (stdenv.lib) optional optionals optionalString;
|
2017-01-25 14:20:18 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "knot-resolver-${version}";
|
2018-01-23 14:46:14 +00:00
|
|
|
version = "1.5.3";
|
2017-01-25 14:20:18 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://secure.nic.cz/files/knot-resolver/${name}.tar.xz";
|
2018-01-23 14:46:14 +00:00
|
|
|
sha256 = "03sb05zz6qn966apcprdqhmirkz7kjdbx8hswbvgamk1s2xd7v6f";
|
2017-01-25 14:20:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
configurePhase = ":";
|
|
|
|
|
2017-01-30 19:07:44 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig which makeWrapper 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-01-25 14:20:18 +00:00
|
|
|
++ optional doInstallCheck cmocka
|
2017-09-22 10:27:59 +01:00
|
|
|
++ optional stdenv.isLinux systemd # sd_notify
|
|
|
|
++ optionals extraFeatures [
|
2017-01-25 14:20:18 +00:00
|
|
|
hiredis libmemcached # additional cache backends
|
|
|
|
];
|
2017-09-22 10:27:59 +01:00
|
|
|
## optional dependencies; TODO: libedit, dnstap, http2 module?
|
2017-01-25 14:20:18 +00:00
|
|
|
|
2017-09-22 10:27:59 +01:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "ROOTHINTS=${dns-root-data}/root.hints" ];
|
2017-01-25 14:20:18 +00:00
|
|
|
CFLAGS = [ "-O2" "-DNDEBUG" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-12-12 14:10:18 +00:00
|
|
|
doCheck = true;
|
2017-01-25 14:20:18 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
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 = ''
|
|
|
|
rm "$out"/etc/kresd/root.hints # using system-wide instead
|
|
|
|
''
|
2017-01-25 14:20:18 +00:00
|
|
|
# optional: to allow auto-bootstrapping root trust anchor via https
|
2017-09-22 10:27:59 +01:00
|
|
|
+ (with luajitPackages; ''
|
|
|
|
wrapProgram "$out/sbin/kresd" \
|
|
|
|
--set LUA_PATH '${
|
|
|
|
stdenv.lib.concatStringsSep ";"
|
|
|
|
(map getLuaPath [ luasec luasocket ])
|
|
|
|
}' \
|
|
|
|
--set LUA_CPATH '${
|
|
|
|
stdenv.lib.concatStringsSep ";"
|
|
|
|
(map getLuaCPath [ luasec luasocket ])
|
|
|
|
}'
|
|
|
|
'');
|
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 */ ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|