diff --git a/pkgs/servers/sql/postgresql/libpq.nix b/pkgs/servers/sql/postgresql/libpq.nix index 0c064e45cf99d..59e7bfd8dba00 100644 --- a/pkgs/servers/sql/postgresql/libpq.nix +++ b/pkgs/servers/sql/postgresql/libpq.nix @@ -12,6 +12,7 @@ # build dependencies bison, flex, + makeWrapper, perl, pkg-config, @@ -62,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ bison flex + makeWrapper perl pkg-config ]; @@ -111,7 +113,20 @@ stdenv.mkDerivation (finalAttrs: { make -C src/interfaces/libpq install make -C src/port install + # Pretend pg_config is located in $out/bin to return correct paths, but + # actually have it in -dev to avoid pulling in all other outputs. moveToOutput bin/pg_config "$dev" + wrapProgram "$dev/bin/pg_config" --argv0 "$out/bin/pg_config" + + # To prevent a "pg_config: could not find own program executable" error, we fake + # pg_config in the default output. + mkdir -p "$out/bin" + cat << EOF > "$out/bin/pg_config" && chmod +x "$out/bin/pg_config" + #!${stdenv.shell} + echo The real pg_config can be found in the -dev output. + exit 1 + EOF + moveToOutput "lib/*.a" "$dev" rm -rfv $out/share diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 978c42a0d3052..8f3add1a34f0f 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -636,7 +636,6 @@ lib.makeScope pkgs.newScope ( { name = "pdo_pgsql"; internalDeps = [ php.extensions.pdo ]; - buildInputs = [ libpq ]; configureFlags = [ "--with-pdo-pgsql=${lib.getDev libpq}" ]; doCheck = false; } @@ -651,7 +650,6 @@ lib.makeScope pkgs.newScope ( name = "pgsql"; buildInputs = [ pcre2 - libpq ]; configureFlags = [ "--with-pgsql=${lib.getDev libpq}" ]; doCheck = false;