From 6d2168c73cf506d5f9e0bac3aed6e2762b6f9d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 24 Aug 2022 18:14:26 +0200 Subject: [PATCH 1/2] knot-resolver: patch library loading for darwin Apparently until now it could never start up on x86_64-darwin :-/ --- pkgs/servers/dns/knot-resolver/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/servers/dns/knot-resolver/default.nix b/pkgs/servers/dns/knot-resolver/default.nix index 61f105a62bd4..833be5b53429 100644 --- a/pkgs/servers/dns/knot-resolver/default.nix +++ b/pkgs/servers/dns/knot-resolver/default.nix @@ -39,6 +39,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 '' From 6ffee2b5d0e1b617385521cd1ad0388d7a423ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 24 Aug 2022 18:15:12 +0200 Subject: [PATCH 2/2] knot-resolver: run more tests also on *-darwin The tests need patching a bit, until the next release. These tests would e.g. discover that kresd didn't work at all until the patch in the parent commit. --- pkgs/servers/dns/knot-resolver/default.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/dns/knot-resolver/default.nix b/pkgs/servers/dns/knot-resolver/default.nix index 833be5b53429..dc14049b9dbb 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 <