1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/servers/dns/knot-resolver/default.nix

71 lines
2 KiB
Nix
Raw Normal View History

2017-07-28 14:33:40 +01:00
{ stdenv, fetchurl, pkgconfig, hexdump, which
, knot-dns, luajit, libuv, lmdb
, cmocka, systemd, hiredis, libmemcached
, gnutls, nettle
, luajitPackages, makeWrapper
}:
let
inherit (stdenv.lib) optional;
in
stdenv.mkDerivation rec {
name = "knot-resolver-${version}";
version = "1.3.3";
src = fetchurl {
url = "http://secure.nic.cz/files/knot-resolver/${name}.tar.xz";
sha256 = "c679238bea5744de8a99f4402a61e9e58502bc42b40ecfa370e53679ed5d5b80";
};
outputs = [ "out" "dev" ];
configurePhase = ":";
nativeBuildInputs = [ pkgconfig which makeWrapper hexdump ];
buildInputs = [ knot-dns luajit libuv gnutls ]
++ optional stdenv.isLinux lmdb # system lmdb causes some problems on Darwin
## optional dependencies; TODO: libedit, dnstap?
++ optional doInstallCheck cmocka
++ optional stdenv.isLinux systemd # socket activation
++ [
nettle # DNS cookies
hiredis libmemcached # additional cache backends
# http://knot-resolver.readthedocs.io/en/latest/build.html#requirements
];
makeFlags = [ "PREFIX=$(out)" ];
CFLAGS = [ "-O2" "-DNDEBUG" ];
enableParallelBuilding = true;
doInstallCheck = true;
installCheckTarget = "check";
preInstallCheck = ''
export LD_LIBRARY_PATH="$out/lib"
'';
# optional: to allow auto-bootstrapping root trust anchor via https
postInstall = 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 ])
}'
'';
meta = with stdenv.lib; {
description = "Caching validating DNS resolver, from .cz domain registry";
homepage = https://knot-resolver.cz;
license = licenses.gpl3Plus;
# Platforms using negative pointers for stack won't work ATM due to LuaJIT impl.
platforms = filter (p: p != "aarch64-linux") platforms.unix;
maintainers = [ maintainers.vcunat /* upstream developer */ ];
};
}