diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index a6bbe3871dc3a5..1810acef6897fe 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -380,10 +380,19 @@ 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 ( + let + pythonPath = "${python3}/lib/python${python3.sourceVersion.major}.${python3.sourceVersion.minor}/site-packages"; + in + '' + wrapProgram "$out/bin/postgres" --set PYTHONPATH "${pythonPath}" + '' + ); # 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