From de4489a672a635a350bae6094422a5917794f77a Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 14 Jan 2022 15:41:14 +0100 Subject: [PATCH 1/2] Forbid runtime references to boost We explicitly hack around to remove them, so might as well check that the hack is useful. (Introduced because I feared that the changes of https://github.com/NixOS/nix/pull/5906#discussion_r784810238 would bring back some runtime references) --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index f4fae2a00..026433c52 100644 --- a/flake.nix +++ b/flake.nix @@ -299,6 +299,8 @@ propagatedBuildInputs = propagatedDeps; + disallowedReferences = [ boost ]; + preConfigure = '' # Copy libboost_context so we don't get all of Boost in our closure. From dd3aa1e5158f5692326f282985ec03300ed452b2 Mon Sep 17 00:00:00 2001 From: regnat Date: Sat, 15 Jan 2022 11:32:57 +0100 Subject: [PATCH 2/2] Remove the references to boost on darwin --- flake.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/flake.nix b/flake.nix index 026433c52..86601fcd9 100644 --- a/flake.nix +++ b/flake.nix @@ -312,6 +312,13 @@ chmod u+w $out/lib/*.so.* patchelf --set-rpath $out/lib:${currentStdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} + ${lib.optionalString currentStdenv.isDarwin '' + for LIB in $out/lib/*.dylib; do + chmod u+w $LIB + install_name_tool -id $LIB $LIB + done + install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib + ''} ''; configureFlags = configureFlags ++ @@ -328,6 +335,12 @@ postInstall = '' mkdir -p $doc/nix-support echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products + ${lib.optionalString currentStdenv.isDarwin '' + install_name_tool \ + -change ${boost}/lib/libboost_context.dylib \ + $out/lib/libboost_context.dylib \ + $out/lib/libnixutil.dylib + ''} ''; doInstallCheck = true;