From 2760818f062b6810da6766639c543aeb1db45522 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Wed, 29 May 2024 20:11:12 -0600 Subject: [PATCH] package: fix derivation correctness when static Change-Id: I394bb72d9f378cd78acc6cf67a9bb15e342d57c4 --- package.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package.nix b/package.nix index 22cf11cd9..cc5902a91 100644 --- a/package.nix +++ b/package.nix @@ -201,7 +201,7 @@ stdenv.mkDerivation (finalAttrs: { # so we must explicitly enable or disable features that we are not passing # dependencies for. (lib.mesonEnable "internal-api-docs" internalApiDocs) - (lib.mesonBool "enable-tests" finalAttrs.doCheck) + (lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck) (lib.mesonBool "enable-docs" canRunInstalled) ] ++ lib.optional (hostPlatform != buildPlatform) "--cross-file=${mesonCrossFile}"; @@ -286,7 +286,7 @@ stdenv.mkDerivation (finalAttrs: { cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib rm -f $out/lib/*.a '' - + lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isLinux) '' + + lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isLinux && !hostPlatform.isStatic) '' chmod u+w $out/lib/*.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* '' @@ -417,11 +417,17 @@ stdenv.mkDerivation (finalAttrs: { name = "lix-shell-env"; - inputsFrom = [ finalAttrs ]; + # finalPackage is necessary to propagate stuff that is set by mkDerivation itself, + # like doCheck. + inputsFrom = [ finalAttrs.finalPackage ]; # For Meson to find Boost. env = finalAttrs.env; + # I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom, + # which only propagates stuff set in hooks? idk. + inherit (finalAttrs) mesonFlags; + packages = lib.optional (stdenv.cc.isClang && hostPlatform == buildPlatform) clang-tools_llvm ++ [