-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
libpq: init at 16.1 #234470
Conversation
homepage = "https://www.postgresql.org"; | ||
description = "Client API library for PostgreSQL"; | ||
license = licenses.postgresql; | ||
maintainers = with maintainers; [ szlend ]; |
There was a problem hiding this comment.
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.
pkgs/top-level/all-packages.nix
Outdated
@@ -26027,6 +26027,8 @@ with pkgs; | |||
|
|||
timescaledb-tune = callPackage ../development/tools/database/timescaledb-tune { }; | |||
|
|||
libpq = callPackage ../servers/sql/postgresql/libpq.nix { postgresql = postgresql_15; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should always point to the latest release of postgresql. Maybe leave a comment? Or maybe we need a postgresql_latest
alias?
I think we either need a postgresql_latest
alias, or collaboration with existing postgresql maintainers to make sure this is always pointing to the latest version.
Still relevant. Updated to 16.0 and rebased. |
What other distros solve by adding more packages can be solved in nixpkgs by adding outputs (most common example is
From a closure size perspective, this isn't much of a difference, so I think that using I randomly checked a few packages that connect to postgres ( Please correct me if I'm wrong, but that said, the main concern are cross-builds requiring
I have a different one though: you don't add The concern I have is that on postgres upgrades, required fixes for this package will be either missed or an additional burden for the postgresql maintainers because it's e.g. necessary to find out which I'm somewhat afraid that Also, in an ideal world, not much of Regarding (purely) static builds: even with a quick eval fix from me (removing the Finally, please note that I'm only raising concerns I have as a package-maintainer. This is not a strict 👎, so please tell me if you disagree! |
I think the main issue with current postgresql.lib is that it couples the default postgres server version with the default library version. The main advantage of separate libpq is that we can keep libpq updated without touching the binary. Or perhaps we should just create a postgresql_latest alias and always use |
I can give a shot making |
If a package is incompatible with a postgresl version for whatever reason shouldn't that error out loudly at build time? |
It's a 8MB, or 92% reduction in the package size. I don't think it's fair to compare full closures as most of that size comes from openssl and glibc which are shared with pretty much every other package. It's not an insignificant difference when you're trying to ship compact container images. This is something nix/nixpkgs is supposed to be good at, right?
Yes, trying to cross-compile postgresql from darwin to linux has been incredibly painful as a lot of dependencies (that otherwise wouldn't be necessary for libpq) just didn't build. I initially had to do a lot of override workarounds to get it to work. At one point those overrides were spanning 3 layers deep into the dependency tree. I already upstreamed most of those fixes to nixpkgs, so it's a lot easier to cross-compile today. As of right now you only need to disable systemd support to get it to build, so it's not so bad anymore. It still takes a while to build all that though compared to just libpq in isolation. I ended up just using the custom libpq derivation for that reason alone.
I would argue it's probably easier to maintain libpq than the current set of patches and workarounds that try to make it work with a separate I agree that collaboration with postgresql maintainers is a prerequisite for this to go through. They've been pretty resistant to supporting a separate libpq package though and at the of the day it's their time and effort so I'm not gonna try to push more work on them if that's how they feel about this change. I came up with an alternative libpq-only |
src = postgresql.src; | ||
|
||
configureFlags = [ | ||
"--with-openssl" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
buildPhase = '' | ||
runHook preBuild | ||
|
||
make -C src/bin/pg_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no other way to build this?
It looks a strange thing to me:
You are basically doing a foreach
-like loop.
What happens when you try to run each of them separately?
Can you install each of them separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out there's a submake-libpq
makefile build target. But there's no equivalent for installing these unfortunately.
installPhase = '' | ||
runHook preInstall | ||
|
||
make -C src/bin/pg_config install |
There was a problem hiding this comment.
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.
Closing in favor of #294504 |
Description of changes
Re: #61580
In my opinion
libpq
being a standalone derivation separate frompostgresql
makes the most sense. Here's why:libpq
is one of the most popular libraries out there. It's a dependency of every single application that connects to a postgres database. As such I feel it deserves special considerations.libpq
will likely be used in variety of different ways (static linking, cross-compilation, etc.). Being an output of the entirepostgresql
derivation causes additional friction as it has to build a ton of additional dependencies that may or may not work in those configurations. By minimizing the number of build-time dependencies we make the whole build process much smoother.pkgsCross.aarch64-multiplatform.libpq
just work is much nicer than playing whack-a-mole with(pkgsCross.aarch64-multiplatform.postgresql.overrides { ... }).lib
, trying to figure out which magic set of overrides it will work with (or break in the next nixpkgs release).postgresql.lib
to only includelibpq
is a breaking change and has so far caused a ton of bike-shedding conversations on what it should be, while 4 years later we're the only major package repository that doesn't ship this.libpq
is guaranteed to be backwards compatible so it only needs to be based onpostgresql_<latest>.src
.libpq
is really easy to package on its own.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)