From 16209df1650a4aae7411d53f97cf8ea0f3fb6ac2 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 4 Feb 2024 21:52:35 +0100 Subject: [PATCH] haskellPackages.postgresql-libpq: Use pkg-config instead of pg_config to find libpq During configure, postgresql-libpq's Setup.hs will try to execute pg_config to find libpq. This will not work when cross-compiling, because pg_config was compiled for the target system, but needs to run on the host. The "use-pkg-config" flag allows to do this via pkg-config instead, which works better in those cases. --- pkgs/development/haskell-modules/configuration-nix.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 1fce8999643ae..c0a2d4c59542c 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -1379,4 +1379,12 @@ self: super: builtins.intersectAttrs super { mpi-hs-cereal mpi-hs-binary ; + + postgresql-libpq = overrideCabal (drv: { + # Using use-pkg-config flag, because pg_config won't work when cross-compiling. + configureFlags = drv.configureFlags or [] ++ [ "-fuse-pkg-config" ]; + # Move postgresql from SystemDepends to PkgconfigDepends + libraryPkgconfigDepends = drv.librarySystemDepends; + librarySystemDepends = []; + }) super.postgresql-libpq; }