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 */
|
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}";
|
2018-08-20 10:23:36 +01:00
|
|
|
version = "3.0.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-08-20 10:23:36 +01:00
|
|
|
sha256 = "68a0137e0e15061ee7dec53a2e424aa3266611720db3843853c6e7774a414f40";
|
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
|
|
|
};
|
|
|
|
|
|
|
|
wrapped-full = with luajitPackages; let
|
2018-07-08 08:21:16 +01:00
|
|
|
luaPkgs = [
|
|
|
|
luasec luasocket # trust anchor bootstrap, prefill module
|
|
|
|
lfs # prefill module
|
2018-07-30 16:36:23 +01:00
|
|
|
# Almost all is for the 'http' module:
|
|
|
|
http cqueues fifo lpeg lpeg_patterns luaossl compat53 basexx
|
2018-07-08 08:21:16 +01:00
|
|
|
];
|
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
|