1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/pkgs/servers/dns/knot-resolver/default.nix
Vladimír Čunát 2becf90c93
knot-resolver: 2.2.0 -> 2.3.0 (security)
Contains fixes for CVE-2018-1110.
2018-04-23 13:26:57 +02:00

83 lines
2.5 KiB
Nix

{ stdenv, fetchurl, runCommand, pkgconfig, hexdump, which
, 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
}:
let # un-indented, over the whole file
result = if extraFeatures then wrapped-full else unwrapped;
inherit (stdenv.lib) optional optionals optionalString concatStringsSep;
unwrapped = stdenv.mkDerivation rec {
name = "knot-resolver-${version}";
version = "2.3.0";
src = fetchurl {
url = "http://secure.nic.cz/files/knot-resolver/${name}.tar.xz";
sha256 = "2d19c5daf8440bd3d2acd1886b9ede65f04f7753c6fd4618a92a1a4ba3b27a9b";
};
outputs = [ "out" "dev" ];
configurePhase = "patchShebangs scripts/";
nativeBuildInputs = [ pkgconfig which hexdump ];
# http://knot-resolver.readthedocs.io/en/latest/build.html#requirements
buildInputs = [ knot-dns luajit libuv gnutls nettle lmdb ]
++ optional doCheck cmocka
++ optional stdenv.isLinux systemd # sd_notify
## optional dependencies; TODO: libedit, dnstap
;
makeFlags = [
"PREFIX=$(out)"
"ROOTHINTS=${dns-root-data}/root.hints"
"KEYFILE_DEFAULT=${dns-root-data}/root.ds"
];
CFLAGS = [ "-O2" "-DNDEBUG" ];
enableParallelBuilding = true;
doCheck = true;
doInstallCheck = false; # FIXME
preInstallCheck = ''
patchShebangs tests/config/runtest.sh
'';
postInstall = ''
rm "$out"/etc/knot-resolver/root.hints # using system-wide instead
'';
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 */ ];
};
};
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