aboutsummaryrefslogtreecommitdiff
path: root/pkgs/servers/dns/knot-resolver/default.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2020-02-05 19:27:16 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2020-02-05 19:41:25 +0100
commit419bc0a4cdc0f577062f6c439809f4bf6e3b0c63 (patch)
tree0f39c63fcddea75c562825d53a3f36bbba8b7930 /pkgs/servers/dns/knot-resolver/default.nix
parent873e6a4e65451be32e8dcd6151e1f26262ef35f2 (diff)
Revert "Revert "Merge master into staging-next""
In 87a19e9048773d5a363679617406ad148d36c3b8 I merged staging-next into master using the GitHub gui as intended. In ac241fb7a570d6cf81d229ad22a8889602639160 I merged master into staging-next for the next staging cycle, however, I accidentally pushed it to master. Thinking this may cause trouble, I reverted it in 0be87c79797a5fa384fbc356c74ed54f9f7829ea. This was however wrong, as it "removed" master. This reverts commit 0be87c79797a5fa384fbc356c74ed54f9f7829ea.
Diffstat (limited to '')
-rw-r--r--pkgs/servers/dns/knot-resolver/default.nix70
1 files changed, 36 insertions, 34 deletions
diff --git a/pkgs/servers/dns/knot-resolver/default.nix b/pkgs/servers/dns/knot-resolver/default.nix
index 953d8ebcbae6..c1c826b78129 100644
--- a/pkgs/servers/dns/knot-resolver/default.nix
+++ b/pkgs/servers/dns/knot-resolver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, fetchpatch
# native deps.
, runCommand, pkgconfig, meson, ninja, makeWrapper
# build+runtime deps.
@@ -11,31 +11,38 @@ let # un-indented, over the whole file
result = if extraFeatures then wrapped-full else unwrapped;
-inherit (stdenv.lib) optional optionals concatStringsSep;
+inherit (stdenv.lib) optional optionals;
lua = luajitPackages;
-# FIXME: remove these usages once resolving
-# https://github.com/NixOS/nixpkgs/pull/63108#issuecomment-508670438
-exportLuaPathsFor = luaPkgs: ''
- export LUA_PATH='${ concatStringsSep ";" (map lua.getLuaPath luaPkgs)}'
- export LUA_CPATH='${concatStringsSep ";" (map lua.getLuaCPath luaPkgs)}'
-'';
-
unwrapped = stdenv.mkDerivation rec {
pname = "knot-resolver";
- version = "4.3.0";
+ version = "5.0.1";
src = fetchurl {
url = "https://secure.nic.cz/files/knot-resolver/${pname}-${version}.tar.xz";
- sha256 = "0ca0f171ae2b2d76830967a5150eb0fa496b48b2a48f41b2be65d3743aaece25";
+ sha256 = "4a93264ad0cda7ea2252d1ba057e474722f77848165f2893e0c76e21ae406415";
};
outputs = [ "out" "dev" ];
+ # Path fixups for the NixOS service.
+ postPatch = ''
+ patch meson.build <<EOF
+ @@ -50,2 +50,2 @@
+ -systemd_work_dir = join_paths(prefix, get_option('localstatedir'), 'lib', 'knot-resolver')
+ -systemd_cache_dir = join_paths(prefix, get_option('localstatedir'), 'cache', 'knot-resolver')
+ +systemd_work_dir = '/var/lib/knot-resolver'
+ +systemd_cache_dir = '/var/cache/knot-resolver'
+ EOF
+
+ # ExecStart can't be overwritten in overrides.
+ # We need that to use wrapped executable and correct config file.
+ sed '/^ExecStart=/d' -i systemd/kresd@.service.in
+ '';
+
preConfigure = ''
patchShebangs scripts/
- ''
- + stdenv.lib.optionalString doInstallCheck (exportLuaPathsFor [ lua.cqueues lua.basexx ]);
+ '';
nativeBuildInputs = [ pkgconfig meson ninja ];
@@ -53,16 +60,17 @@ unwrapped = stdenv.mkDerivation rec {
]
++ optional doInstallCheck "-Dunit_tests=enabled"
++ optional (doInstallCheck && !stdenv.isDarwin) "-Dconfig_tests=enabled"
+ ++ optional stdenv.isLinux "-Dsystemd_files=enabled" # used by NixOS service
#"-Dextra_tests=enabled" # not suitable as in-distro tests; many deps, too.
;
postInstall = ''
rm "$out"/lib/libkres.a
+ rm "$out"/lib/knot-resolver/upgrade-4-to-5.lua # not meaningful on NixOS
'';
- # aarch64: see https://github.com/wahern/cqueues/issues/223
- doInstallCheck = with stdenv; hostPlatform == buildPlatform && !hostPlatform.isAarch64;
- installCheckInputs = [ cmocka which cacert ];
+ doInstallCheck = with stdenv; hostPlatform == buildPlatform;
+ installCheckInputs = [ cmocka which cacert lua.cqueues lua.basexx ];
installCheckPhase = ''
meson test --print-errorlogs
'';
@@ -76,37 +84,31 @@ unwrapped = stdenv.mkDerivation rec {
};
};
-# FIXME: revert this back after resolving
-# https://github.com/NixOS/nixpkgs/pull/63108#issuecomment-508670438
-wrapped-full =
- with stdenv.lib;
- with luajitPackages;
- let
- luaPkgs = [
- luasec luasocket # trust anchor bootstrap, prefill module
- luafilesystem # prefill module
- http # for http module; brings lots of deps; some are useful elsewhere
- cqueues fifo lpeg lpeg_patterns luaossl compat53 basexx binaryheap
- ];
- in runCommand unwrapped.name
+wrapped-full = runCommand unwrapped.name
{
nativeBuildInputs = [ makeWrapper ];
+ buildInputs = with luajitPackages; [
+ # For http module, prefill module, trust anchor bootstrap.
+ # It brings lots of deps; some are useful elsewhere (e.g. cqueues).
+ http
+ # psl isn't in nixpkgs yet, but policy.slice_randomize_psl() seems not important.
+ ];
preferLocalBuild = true;
allowSubstitutes = false;
}
- (exportLuaPathsFor luaPkgs
- + ''
- mkdir -p "$out"/{bin,share}
+ ''
+ mkdir -p "$out"/bin
makeWrapper '${unwrapped}/bin/kresd' "$out"/bin/kresd \
--set LUA_PATH "$LUA_PATH" \
--set LUA_CPATH "$LUA_CPATH"
- ln -sr '${unwrapped}/share/man' "$out"/share/
+ ln -sr '${unwrapped}/share' "$out"/
+ ln -sr '${unwrapped}/lib' "$out"/ # useful in NixOS service
ln -sr "$out"/{bin,sbin}
echo "Checking that 'http' module loads, i.e. lua search paths work:"
echo "modules.load('http')" > test-http.lua
echo -e 'quit()' | env -i "$out"/bin/kresd -a 127.0.0.1#53535 -c test-http.lua
- '');
+ '';
in result