Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpq: init at 16.1 #234470

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions pkgs/servers/sql/postgresql/libpq.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{ stdenv
, lib
, openssl
, zlib
, libkrb5
, icu
, postgresql
, pkg-config
, tzdata
, gssSupport ? !stdenv.hostPlatform.isWindows
}:

stdenv.mkDerivation {
pname = "libpq";
inherit (postgresql) src version;

configureFlags = [
"--with-openssl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using lib/strings functions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

"--with-icu"
"--without-readline"
"--with-system-tzdata=${tzdata}/share/zoneinfo"
"--enable-debug"
]
++ lib.optionals gssSupport [ "--with-gssapi" ];

nativeBuildInputs = [ pkg-config tzdata ];
buildInputs = [ openssl zlib icu ]
++ lib.optional gssSupport libkrb5;

enableParallelBuilding = !stdenv.isDarwin;

separateDebugInfo = true;

buildFlags = [ "submake-libpq" "submake-libpgport" ];

installPhase = ''
runHook preInstall

make -C src/bin/pg_config install
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong:

$ pg_config

...
LIBDIR = /nix/store/mvwrr8g7m7xk39k47qbnwsdg28cby2x2-libpq-16.1-dev/lib
...

This probably needs to be patched the same way as the complete postgres package. Hence it's necessary to reach an agreement with the maintainers first.

make -C src/common install
make -C src/include install
make -C src/interfaces/libpq install
make -C src/port install

moveToOutput "bin" "$dev"
moveToOutput "lib/*.a" "$static"
rm -rfv $out/share

runHook postInstall
'';

outputs = [ "out" "dev" "static" ];

meta = with lib; {
homepage = "https://www.postgresql.org";
description = "Client API library for PostgreSQL";
license = licenses.postgresql;
maintainers = with maintainers; [ szlend ];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably would want to include existing postgresql maintainers.

platforms = platforms.unix;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27123,6 +27123,8 @@ with pkgs;

timescaledb-tune = callPackage ../development/tools/database/timescaledb-tune { };

libpq = callPackage ../servers/sql/postgresql/libpq.nix { postgresql = postgresql_16; };

inherit (import ../servers/sql/postgresql pkgs)
postgresql_12
postgresql_13
Expand Down