From f649fb8b4a4c30989d8a90ca57c1eaef09cc605d Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Fri, 1 Apr 2022 09:14:19 +0200 Subject: [PATCH] haskellPackages.mkDerivation: fix pkg-config cross When cross compiling the pkg-config binary is prefixed and cabal needs to be made aware of this. Note: the `--with-pkg-config` flag can't be added unconditionally because if the package doesn't need pkg-config (thus pkg-config is not in the PATH) cabal consider this a hard failure. --- pkgs/development/haskell-modules/generic-builder.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 04973d3251e6e..a9692b5a0f012 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -181,7 +181,8 @@ let ] ++ optionals (!isHaLVM) [ "--hsc2hs-option=--cross-compile" (optionalString enableHsc2hsViaAsm "--hsc2hs-option=--via-asm") - ]; + ] ++ optional (allPkgconfigDepends != []) + "--with-pkg-config=${pkg-config.targetPrefix}pkg-config"; parallelBuildingFlags = "-j$NIX_BUILD_CORES" + optionalString stdenv.isLinux " +RTS -A64M -RTS";