Skip to content

postgresql.withPackages: propagate out from dev output#425384

Closed
B4dM4n wants to merge 1 commit intoNixOS:masterfrom
B4dM4n:postgresql-with-packages-propagate
Closed

postgresql.withPackages: propagate out from dev output#425384
B4dM4n wants to merge 1 commit intoNixOS:masterfrom
B4dM4n:postgresql-with-packages-propagate

Conversation

@B4dM4n
Copy link
Contributor

@B4dM4n B4dM4n commented Jul 15, 2025

Currently the combination of postgresql.withPackages and postgresqlTestHook is broken, since the hook can't find the postgresql binaries:

/nix/store/04xc8i3h5qvbl17fm6dw9dfk3ls0fi5b-postgresql-test-hook/nix-support/setup-hook: line 52: type: initdb: not found
initdb not found. Did you add postgresql to the nativeCheckInputs?

This behavior as introduced by #422969, with the addition of a dev output. The used buildEnv helper doesn't run the regular postFixupHook, so nix-support/propagated-build-inputs doesn't get populated as usual by multiple-outputs.sh.

Fixes #425285

Things done

Built the following packages for x86_64-linux:

❌ 7 packages failed to build:
  • postgresql18Packages.omnigres
  • postgresql18Packages.omnigres.passthru.tests.extension
  • froide
  • python312Packages.froide
  • python313Packages.txtai
  • python312Packages.txtai
  • private-gpt.passthru.tests.private-gpt
✅ 5 tests built:
  • postgresql14Packages.omnigres.passthru.tests.extension
  • postgresql16Packages.omnigres.passthru.tests.extension
  • postgresql15Packages.omnigres.passthru.tests.extension
  • postgresqlPackages.omnigres.passthru.tests.extension
  • open-webui.passthru.tests.open-webui
✅ 24 packages built:
  • postgresql14Packages.omnigres
  • postgresql15Packages.omnigres
  • postgresqlPackages.omnigres
  • postgresql_13_jit
  • postgresql16Packages.omnigres
  • postgresql_14_jit
  • postgresql_15_jit
  • postgresql_16_jit
  • postgresql_jit
  • postgresql_18_jit
  • python312Packages.langgraph-checkpoint-postgres
  • python312Packages.langgraph
  • python312Packages.pgvector
  • python312Packages.langgraph-prebuilt
  • python312Packages.llama-index-vector-stores-postgres
  • open-webui
  • python313Packages.langgraph-prebuilt
  • python313Packages.langgraph
  • python313Packages.pgvector
  • python313Packages.llama-index-vector-stores-postgres
  • python313Packages.langgraph-checkpoint-postgres
  • private-gpt
  • python312Packages.private-gpt
  • python313Packages.private-gpt

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. labels Jul 15, 2025
@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented Jul 15, 2025

Hm, when I build postgresql_jit (which uses withPackages), I get this:

(Edit: nvm, that was a different derivation's build log there in my earlier version...)

building '/nix/store/q6dqswkjrfdy8zgg25yjdfzpa8spxpki-postgresql-and-plugins-17.5.drv'...
created 370 symlinks in user environment
/nix/store/nxkilcrxklffnakjipryq3zyvsl6938h-postgresql-and-plugins-17.5-dev

Which doesn't run the fixupPhase, indeed.

I can't find any code to verify this claim:

The used buildEnv helper doesn't run the regular postFixupHook

Where does this happen? I think the phases should normally be run, but I can't find where they are disabled.

@wolfgangwalther
Copy link
Contributor

Ah, the builder for buildEnv indeed does only this:

      ${buildPackages.perl}/bin/perl -w ${builder}
      eval "$postBuild"

I see it now... that's really annoying.

@JohnRTitor JohnRTitor mentioned this pull request Jul 15, 2025
13 tasks
JohnRTitor added a commit to JohnRTitor/nix-conf that referenced this pull request Jul 15, 2025
Cherry picked commits from
1. NixOS/nixpkgs#425384
2. NixOS/nixpkgs#425382

Signed-off-by: John Titor <[email protected]>
Comment on lines +674 to +676

# populate nix-support/propagated-build-inputs
eval fixupPhase
Copy link
Contributor

@wolfgangwalther wolfgangwalther Jul 15, 2025

Choose a reason for hiding this comment

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

This is certainly quite hacky. I can't think of anything better, though. Maybe we could create a "proper" derivation, which copies all the symlinks from the buildEnv and then runs all the regular phases. Or we could extend buildEnv to support more things. Outputs, phases, ..

But both of that seems more than we should do to unbreak python3Packages.pgvector now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A proper derivation is probably the best solution in the near future.

buildEnv just wasn't build to handle man outputs, dev outputs or now custom phases.

In the future, a generic wrapper would be nice, which combines all outputs from a list packages and produces a "normal" derivation with the same outputs. But how it decides to merge files like nix-support/propagated-build-inputs from multiple packages wouldn't be trivial and probably require manual logic.

For now this is the "cleanest" solution I could find. I thought that I have seen other packages use the same mechanism yesterday, but now I can't find them anymore (except two very weird uses).

Copy link
Member

Choose a reason for hiding this comment

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

I already see the postgres team taking ownership of pkgs.buildEnv

First of all, how many packages are affected? I'm kinda wondering if we should get something out quickly.

I'm not entirely sure if I think it's reasonable to add support for multiple outputs to buildEnv and on top of that, though "having a multi-output derivation where one output happens to be an env" isn't too unreasonable. OTOH in that case further questions would be "how to do envs in multpiple outputs" or "how to decide which output gets the env" and the idea to just allow multiple outputs seem a little short-sighted, doesn't it?

I'm wondering, perhaps it might be an option to just create a single buildEnv { paths = [ ... ]; } and on top a derivation that takes care of the rest of the magic? I.e. creating a dev output, exposing the withPackages function etc..

Anyways, I'm not entirely sure how to proceed here. I'd rather not merge this hack (unless there's too much stuff we've broke).

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

First of all, how many packages are affected? I'm kinda wondering if we should get something out quickly.

The quick fix was already merged in #426048.

Anyways, I'm not entirely sure how to proceed here. I'd rather not merge this hack.

Neither do I, currently working on a replacement in #426704, which I opened literally minutes ago ;)

This will not need any special magic for buildEnv.

Copy link
Member

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

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

Can we merge this?

Just noting here: we should probably run a nixpkgs-review before merging to staging-next which is intended for bug fixes, not breaking more things.

open-webui along with several other packages on master are broken ever since the staging-next merge.

@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented Jul 17, 2025

This is hacky enough that I wouldn't want to merge it without exploring other ideas first.

Note that there is a simple quick fix that can be done immediately, if other packages should be unbroken: Temporarily disable the check phase for python3Packages.pgvector: #426048.

wolfgangwalther added a commit to wolfgangwalther/nixpkgs that referenced this pull request Jul 17, 2025
Let's disable the checkPhase to unbreak the package and its dependencies
until NixOS#425384 is properly solved.
@wolfgangwalther
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 425384
Commit: 078f0f61c328788aabbcb9465cb299eaeefe5dfe


x86_64-linux

❌ 9 packages failed to build:
  • froide (python313Packages.froide)
  • froide.dist (python313Packages.froide.dist)
  • postgresql18Packages.omnigres
  • python312Packages.froide
  • python312Packages.froide.dist
  • python312Packages.txtai
  • python312Packages.txtai.dist
  • python313Packages.txtai
  • python313Packages.txtai.dist
✅ 44 packages built:
  • open-webui
  • open-webui.dist
  • postgresql14Packages.omnigres
  • postgresql15Packages.omnigres
  • postgresql16Packages.omnigres
  • postgresqlPackages.omnigres (postgresql17Packages.omnigres)
  • postgresql_13_jit
  • postgresql_13_jit.dev
  • postgresql_14_jit
  • postgresql_14_jit.dev
  • postgresql_15_jit
  • postgresql_15_jit.dev
  • postgresql_16_jit
  • postgresql_16_jit.dev
  • postgresql_jit (postgresql_17_jit)
  • postgresql_jit.dev (postgresql_17_jit.dev)
  • postgresql_18_jit
  • postgresql_18_jit.dev
  • private-gpt
  • private-gpt.dist
  • python312Packages.langgraph
  • python312Packages.langgraph-checkpoint-postgres
  • python312Packages.langgraph-checkpoint-postgres.dist
  • python312Packages.langgraph-prebuilt
  • python312Packages.langgraph-prebuilt.dist
  • python312Packages.langgraph.dist
  • python312Packages.llama-index-vector-stores-postgres
  • python312Packages.llama-index-vector-stores-postgres.dist
  • python312Packages.pgvector
  • python312Packages.pgvector.dist
  • python312Packages.private-gpt
  • python312Packages.private-gpt.dist
  • python313Packages.langgraph
  • python313Packages.langgraph-checkpoint-postgres
  • python313Packages.langgraph-checkpoint-postgres.dist
  • python313Packages.langgraph-prebuilt
  • python313Packages.langgraph-prebuilt.dist
  • python313Packages.langgraph.dist
  • python313Packages.llama-index-vector-stores-postgres
  • python313Packages.llama-index-vector-stores-postgres.dist
  • python313Packages.pgvector
  • python313Packages.pgvector.dist
  • python313Packages.private-gpt
  • python313Packages.private-gpt.dist

aarch64-linux

❌ 9 packages failed to build:
  • froide (python313Packages.froide)
  • froide.dist (python313Packages.froide.dist)
  • postgresql18Packages.omnigres
  • python312Packages.froide
  • python312Packages.froide.dist
  • python312Packages.txtai
  • python312Packages.txtai.dist
  • python313Packages.txtai
  • python313Packages.txtai.dist
✅ 42 packages built:
  • postgresql14Packages.omnigres
  • postgresql15Packages.omnigres
  • postgresql16Packages.omnigres
  • postgresqlPackages.omnigres (postgresql17Packages.omnigres)
  • postgresql_13_jit
  • postgresql_13_jit.dev
  • postgresql_14_jit
  • postgresql_14_jit.dev
  • postgresql_15_jit
  • postgresql_15_jit.dev
  • postgresql_16_jit
  • postgresql_16_jit.dev
  • postgresql_jit (postgresql_17_jit)
  • postgresql_jit.dev (postgresql_17_jit.dev)
  • postgresql_18_jit
  • postgresql_18_jit.dev
  • private-gpt
  • private-gpt.dist
  • python312Packages.langgraph
  • python312Packages.langgraph-checkpoint-postgres
  • python312Packages.langgraph-checkpoint-postgres.dist
  • python312Packages.langgraph-prebuilt
  • python312Packages.langgraph-prebuilt.dist
  • python312Packages.langgraph.dist
  • python312Packages.llama-index-vector-stores-postgres
  • python312Packages.llama-index-vector-stores-postgres.dist
  • python312Packages.pgvector
  • python312Packages.pgvector.dist
  • python312Packages.private-gpt
  • python312Packages.private-gpt.dist
  • python313Packages.langgraph
  • python313Packages.langgraph-checkpoint-postgres
  • python313Packages.langgraph-checkpoint-postgres.dist
  • python313Packages.langgraph-prebuilt
  • python313Packages.langgraph-prebuilt.dist
  • python313Packages.langgraph.dist
  • python313Packages.llama-index-vector-stores-postgres
  • python313Packages.llama-index-vector-stores-postgres.dist
  • python313Packages.pgvector
  • python313Packages.pgvector.dist
  • python313Packages.private-gpt
  • python313Packages.private-gpt.dist

x86_64-darwin

❌ 1 package failed to build:
  • postgresql18Packages.omnigres
✅ 16 packages built:
  • postgresql14Packages.omnigres
  • postgresql15Packages.omnigres
  • postgresql16Packages.omnigres
  • postgresqlPackages.omnigres (postgresql17Packages.omnigres)
  • postgresql_13_jit
  • postgresql_13_jit.dev
  • postgresql_14_jit
  • postgresql_14_jit.dev
  • postgresql_15_jit
  • postgresql_15_jit.dev
  • postgresql_16_jit
  • postgresql_16_jit.dev
  • postgresql_jit (postgresql_17_jit)
  • postgresql_jit.dev (postgresql_17_jit.dev)
  • postgresql_18_jit
  • postgresql_18_jit.dev

aarch64-darwin

❌ 1 package failed to build:
  • postgresql18Packages.omnigres
✅ 16 packages built:
  • postgresql14Packages.omnigres
  • postgresql15Packages.omnigres
  • postgresql16Packages.omnigres
  • postgresqlPackages.omnigres (postgresql17Packages.omnigres)
  • postgresql_13_jit
  • postgresql_13_jit.dev
  • postgresql_14_jit
  • postgresql_14_jit.dev
  • postgresql_15_jit
  • postgresql_15_jit.dev
  • postgresql_16_jit
  • postgresql_16_jit.dev
  • postgresql_jit (postgresql_17_jit)
  • postgresql_jit.dev (postgresql_17_jit.dev)
  • postgresql_18_jit
  • postgresql_18_jit.dev

Error logs: `x86_64-linux`
postgresql18Packages.omnigres
creating build/bdist.linux-x86_64/wheel/omni_python
copying build/lib/omni_python/__init__.py -> build/bdist.linux-x86_64/wheel/./omni_python
copying build/lib/omni_python/log.py -> build/bdist.linux-x86_64/wheel/./omni_python
running install_egg_info
Copying src/omni_python.egg-info to build/bdist.linux-x86_64/wheel/./omni_python-0.1.0-py3.13.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/omni_python-0.1.0.dist-info/WHEEL
creating '/build/source/build/languages/python/omni_python/dist/.tmp-a1oxgeym/omni_python-0.1.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'omni_python/__init__.py'
adding 'omni_python/log.py'
adding 'omni_python-0.1.0.dist-info/METADATA'
adding 'omni_python-0.1.0.dist-info/WHEEL'
adding 'omni_python-0.1.0.dist-info/top_level.txt'
adding 'omni_python-0.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built omni_http-0.1.0.tar.gz and omni_http-0.1.0-py3-none-any.whl
Successfully built omni_python-0.1.0.tar.gz and omni_python-0.1.0-py3-none-any.whl
[ 84%] Built target py_omni_http
[ 84%] Built target py_omni_python
make: *** [Makefile:146: all] Error 2

Error logs: `aarch64-linux`
postgresql18Packages.omnigres
[ 91%] Built target omni_polyfill
[ 91%] Linking C shared module omni_yaml--0.1.0.so
[ 91%] Linking C shared module omni_vfs--0.2.1.so
[ 91%] Linking CXX shared module omni_xml--0.1.2.so
[ 93%] Linking C shared module omni_var--0.3.0.so
[ 93%] Built target omni__test_v2
[ 93%] Built target omni_vfs
[ 93%] Built target omni_yaml
[ 93%] Built target omni_var
[ 93%] Built target omni_xml
[ 93%] Linking C shared module omni_types--0.3.4.so
[ 93%] Built target omni_httpc
[ 93%] Linking C shared module omni_seq--0.1.1.so
[ 93%] Built target omni_types
[ 93%] Built target omni_seq
[ 93%] Linking C static library libpcre2-8.a
[ 93%] Built target pcre2-8-static
[ 93%] Linking CXX shared module omni_sqlite--0.1.2.so
[ 93%] Built target omni_sqlite
make: *** [Makefile:146: all] Error 2

Error logs: `x86_64-darwin`
postgresql18Packages.omnigres
[  3%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/lib/fy-token.c.o
In file included from /tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-1/source/build/extensions/omni/CMakeFiles/omni.dir/Unity/unity_0_c.c:4:
/tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-1/source/extensions/omni/init.c:88:3: error: incompatible function pointer types assigning to 'ExecutorStart_hook_type' (aka 'bool (*)(struct QueryDesc *, int)') from 'void (QueryDesc *, int)' (aka 'void (struct QueryDesc *, int)') [-Wincompatible-function-pointer-types]
   88 |   save_hook(executor_start, ExecutorStart_hook);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-1/source/extensions/omni/init.c:84:7: note: expanded from macro 'save_hook'
   84 |   OLD = omni_##NAME##_hook
      |       ^ ~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [extensions/omni/CMakeFiles/omni.dir/build.make:79: extensions/omni/CMakeFiles/omni.dir/Unity/unity_0_c.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1957: extensions/omni/CMakeFiles/omni.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  3%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/lib/fy-types.c.o
[  3%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/lib/fy-utf8.c.o
[  3%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/lib/fy-utils.c.o
[  5%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/lib/fy-walk.c.o
[  5%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/xxhash/xxhash.c.o
[  5%] Linking C static library libfyaml.a
[  5%] Built target fyaml
make: *** [Makefile:146: all] Error 2

Error logs: `aarch64-darwin`
postgresql18Packages.omnigres
[  5%] Built target inja
[  5%] Building C object _deps/libfyaml-build/CMakeFiles/fyaml.dir/src/xxhash/xxhash.c.o
[  5%] Building C object libpgaug/CMakeFiles/libpgaug.dir/libpgaug.c.o
[  5%] Linking C static library liblibpgaug.a
[  5%] Built target libpgaug
[  5%] Building C object extensions/omni/CMakeFiles/omni.dir/Unity/unity_0_c.c.o
In file included from /tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-6/source/build/extensions/omni/CMakeFiles/omni.dir/Unity/unity_0_c.c:4:
/tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-6/source/extensions/omni/init.c:88:3: error: incompatible function pointer types assigning to 'ExecutorStart_hook_type' (aka 'bool (*)(struct QueryDesc *, int)') from 'void (QueryDesc *, int)' (aka 'void (struct QueryDesc *, int)') [-Wincompatible-function-pointer-types]
   88 |   save_hook(executor_start, ExecutorStart_hook);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/nix-build-omnigres-0-unstable-2025-06-27.drv-6/source/extensions/omni/init.c:84:7: note: expanded from macro 'save_hook'
   84 |   OLD = omni_##NAME##_hook
      |       ^ ~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [extensions/omni/CMakeFiles/omni.dir/build.make:79: extensions/omni/CMakeFiles/omni.dir/Unity/unity_0_c.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1957: extensions/omni/CMakeFiles/omni.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  5%] Linking C static library libfyaml.a
[  5%] Built target fyaml
make: *** [Makefile:146: all] Error 2

just intended as a reference for comparison right now, doing the same build in #426048.

wrvsrx pushed a commit to wrvsrx/nixpkgs that referenced this pull request Jul 18, 2025
Let's disable the checkPhase to unbreak the package and its dependencies
until NixOS#425384 is properly solved.
@Zaczero Zaczero mentioned this pull request Jul 28, 2025
3 tasks
@gepbird
Copy link
Contributor

gepbird commented Aug 23, 2025

Froide had the same issue (#428830), which was fixed in ae730b3. Can/should we apply this kind of fix for other packages over merging this?

@wolfgangwalther
Copy link
Contributor

The proper fix is in #426704, but that's still in staging - but this PR is superseded by that, so closing.

ae730b3 should certainly only be a temporary thing.

IIRC, the only other packages that were affected had their tests disabled and re-enabled as part of #426704, so I think we should be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: python3Packages.pgvector

5 participants