From 149497037d7dd935179262d1a55d2ede89c5a58f Mon Sep 17 00:00:00 2001 From: Qyriad Date: Tue, 5 Mar 2024 12:54:38 -0700 Subject: [PATCH] package.nix: migrate preConfigure Change-Id: I4a07553b8dac8dfc58d4c644da15a66f73008f60 --- flake.nix | 21 +-------------------- package.nix | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 4628a71fb..18f9e44e6 100644 --- a/flake.nix +++ b/flake.nix @@ -384,26 +384,7 @@ disallowedReferences ; - preConfigure = lib.optionalString (! currentStdenv.hostPlatform.isStatic) - '' - # Copy libboost_context so we don't get all of Boost in our closure. - # https://github.com/NixOS/nixpkgs/issues/45462 - mkdir -p $out/lib - cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib - rm -f $out/lib/*.a - ${lib.optionalString currentStdenv.hostPlatform.isLinux '' - chmod u+w $out/lib/*.so.* - patchelf --set-rpath $out/lib:${currentStdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* - ''} - ${lib.optionalString currentStdenv.hostPlatform.isDarwin '' - for LIB in $out/lib/*.dylib; do - chmod u+w $LIB - install_name_tool -id $LIB $LIB - install_name_tool -delete_rpath ${boost}/lib/ $LIB || true - done - install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib - ''} - ''; + preConfigure = comDeps.calledPackage.preConfigure; configureFlags = comDeps.configureFlags ++ [ "--sysconfdir=/etc" ] ++ diff --git a/package.nix b/package.nix index a8cf0792e..20485bc0f 100644 --- a/package.nix +++ b/package.nix @@ -142,6 +142,26 @@ in stdenv.mkDerivation (finalAttrs: { boost ]; + preConfigure = lib.optionalString (! stdenv.hostPlatform.isStatic) '' + # Copy libboost_context so we don't get all of Boost in our closure. + # https://github.com/NixOS/nixpkgs/issues/45462 + mkdir -p $out/lib + cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib + rm -f $out/lib/*.a + ${lib.optionalString stdenv.hostPlatform.isLinux '' + chmod u+w $out/lib/*.so.* + patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* + ''} + ${lib.optionalString stdenv.hostPlatform.isDarwin '' + for LIB in $out/lib/*.dylib; do + chmod u+w $LIB + install_name_tool -id $LIB $LIB + install_name_tool -delete_rpath ${boost}/lib/ $LIB || true + done + install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib + ''} + ''; + # FIXME: Used to make checkInputs accessible from outside the derivation args # during the refactor. passthru.finalAttrs = finalAttrs;