Skip to content

Commit

Permalink
postgresql: add PYTHONPATH via wrapProgram
Browse files Browse the repository at this point in the history
Currently `PYTHONPATH` is not set when building PostgreSQL. This results
in Python modules not being available within `pl/python3u`.

This commit adds `PYTHONPATH` of the supplied `python3` via `wrapProgram`,
which is especially useful when supplying a custom Python env.
  • Loading branch information
hrdinka committed Jan 15, 2025
1 parent 6af0112 commit b6773ad
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkgs/servers/sql/postgresql/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,14 @@ let
--replace-fail '-bundle_loader $(bindir)/postgres' "-bundle_loader $out/bin/postgres"
'';

postFixup = lib.optionalString stdenv'.hostPlatform.isGnu ''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
'';
postFixup =
lib.optionalString stdenv'.hostPlatform.isGnu ''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
''
+ lib.optionalString pythonSupport ''
wrapProgram "$out/bin/postgres" --set PYTHONPATH "${python3}/${python3.sitePackages}"
'';

# Running tests as "install check" to work around SIP issue on macOS:
# https://www.postgresql.org/message-id/flat/4D8E1BC5-BBCF-4B19-8226-359201EA8305%40gmail.com
Expand Down

0 comments on commit b6773ad

Please sign in to comment.