summary refs log tree commit diff
path: root/pkgs/servers/dns
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2022-08-28 15:18:41 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2022-08-28 15:18:41 +0200
commit7f6004d021897afe16b6bc9115dd9193d09f9303 (patch)
tree701e41bcf63213cf360d986d78d05865be0540d6 /pkgs/servers/dns
parent0b36375f7f6744b59057f170ef1cb27f535aeb2c (diff)
parent6ffee2b5d0e1b617385521cd1ad0388d7a423ce7 (diff)
Merge #188194: knot-resolver on darwin: patch library loading
and run more tests
Diffstat (limited to 'pkgs/servers/dns')
-rw-r--r--pkgs/servers/dns/knot-resolver/default.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/pkgs/servers/dns/knot-resolver/default.nix b/pkgs/servers/dns/knot-resolver/default.nix
index 61f105a62bd44..dc14049b9dbbf 100644
--- a/pkgs/servers/dns/knot-resolver/default.nix
+++ b/pkgs/servers/dns/knot-resolver/default.nix
@@ -1,4 +1,5 @@
 { lib, stdenv, fetchurl
+, fetchpatch
 # native deps.
 , runCommand, pkg-config, meson, ninja, makeWrapper
 # build+runtime deps.
@@ -26,6 +27,19 @@ unwrapped = stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
+  patches = [
+    (fetchpatch {
+      name = "fix-config-tests-on-darwin.patch";
+      url = "https://gitlab.nic.cz/knot/knot-resolver/-/commit/48ad9d436cf80f58c107774c313a561d852148a0.diff";
+      sha256 = "CEX1XkeYLUSe31xUhNdMRMl1VUXtKFCs5noNJaqL5x0=";
+    })
+    (fetchpatch {
+      name = "fix-config-tests-on-aarch64-darwin.patch";
+      url = "https://gitlab.nic.cz/knot/knot-resolver/-/commit/adaac913c50a5db2f226a081ddc419b0d56d1757.diff";
+      sha256 = "1LrL74luzPTyJ7VBi7fskDga4lYAh7cSUmDcd1BNO78=";
+    })
+  ];
+
   # Path fixups for the NixOS service.
   postPatch = ''
     patch meson.build <<EOF
@@ -39,6 +53,13 @@ unwrapped = stdenv.mkDerivation rec {
     # 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
+
+    # On x86_64-darwin loading by soname fails to find the libs, surprisingly.
+    # Even though they should already be loaded and they're in RPATH, too.
+    for f in daemon/lua/{kres,zonefile}.lua; do
+      substituteInPlace "$f" \
+        --replace "ffi.load(" "ffi.load('${lib.getLib knot-dns}/lib/' .. "
+    done
   ''
     # some tests have issues with network sandboxing, apparently
   + optionalString doInstallCheck ''
@@ -67,7 +88,7 @@ unwrapped = stdenv.mkDerivation rec {
     "--default-library=static" # not used by anyone
   ]
   ++ optional doInstallCheck "-Dunit_tests=enabled"
-  ++ optional (doInstallCheck && !stdenv.isDarwin) "-Dconfig_tests=enabled"
+  ++ optional doInstallCheck "-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.
   ;