Skip to content

nixos/immich: add support for VectorChord - #428568

Merged
dotlambda merged 4 commits into
NixOS:masterfrom
Scrumplex:nixos/immich/vectorchord
Aug 19, 2025
Merged

dotlambda merged 4 commits into
NixOS:masterfrom
Scrumplex:nixos/immich/vectorchord

Conversation

@Scrumplex

@Scrumplex Scrumplex commented Jul 26, 2025 •

Copy link
Copy Markdown
Member

This PR adds enable options for VectorChord and pgvecto.rs respectively. The latter is only enabled by default for system.stateVersion <= 25.11.

Once Immich drops support for pgvecto.rs, we can remove the option and ask users to migrate (i.e. remove the extension and schema).

I have added a test that tranistions from pgvecto.rs only -> pgvecto.rs + VectorChord (automatic migration by Immich) -> VectorChord only

This has not been tested in a real world setup yet!

TODO

  • Write release notes
  • Write migration instructions (in short: drop extension and schema, disable option)
  • Add assertion that either VectorChord and/or pgvecto-rs has to be enabled.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@Scrumplex
Scrumplex force-pushed the nixos/immich/vectorchord branch from 2aeb472 to a8517d5 Compare July 26, 2025 10:49
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 26, 2025
@kevincox

Copy link
Copy Markdown
Contributor

This approach looks reasonable to me but I am not an expert on any of the involved topics.

@Scrumplex
Scrumplex force-pushed the nixos/immich/vectorchord branch from a8517d5 to 7fd6a7f Compare July 27, 2025 10:21
@SchweGELBin

SchweGELBin commented Aug 6, 2025 •

Copy link
Copy Markdown
Contributor

LGTM, I've successfully deployed it to my server. Thanks!
I did a fresh install with PostgreSQL 17 and VectorChord.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Aug 6, 2025
@oluceps oluceps added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Aug 7, 2025

@diogotcorreia diogotcorreia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before anyone accidentally merges this: keep in mind there are still items in the TODO list, like the release notes and an assertion.

Other than that, the code changes LGTM (but I haven't tested in my instance)

@Scrumplex
Scrumplex force-pushed the nixos/immich/vectorchord branch from 7fd6a7f to c6c9f9f Compare August 10, 2025 11:35
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Aug 10, 2025

@Guanran928 Guanran928 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Been using the patches on my instance for two days.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. labels Aug 10, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How are we planning to handle the removal of pgvecto-rs support?
Immich is probably removing it later this year, since they plan to do it before the stable release (in 2025, see roadmap) according to this comment: #392710 (comment)

If it's before May 2026 (NixOS 26.05), does that mean we'll have to stop backporting Immich upgrades? Or can we remove the option (or make it do nothing) mid-cycle?

And what happens if it's before the NixOS 25.11 release in November?

Also, I'm assuming this is going to be backported to 25.05 (once #429374 is merged)

cc @mertalev perhaps we could coordinate on this

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The current plan is to remove pgvecto.rs support pretty soon (within the next month or so). What would be the impact of this on your side?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mertalev Hm... my understanding is that would be a breaking change and we wouldn't be able to continue backporting Immich updates to NixOS 25.05.
It would help a lot to have pgvecto.rs support at least until the end of November (when NixOS 25.11 releases), but obviously I (we) don't want to force you (and the other Immich devs) into maintaining support for it.


cc immich nixos maintainers (again 😅): @dotlambda @jvanbruegge @Scrumplex @Titaniumtown

If we can get support until November, I think it could be doable to:

  • backport this PR to 25.05
  • add to the 25.11 release notes that you must migrate to vectorchord before upgrading to 25.11
  • once upstream drops support for pgvecto.rs (shortly after November), we could remove the options related to pgvecto.rs mid-cycle, since they would be no-op (or even before the 25.11 release in anticipation?)

Let me know if there are other options I'm not thinking about, I'm not very familiar with how strict the breaking changes policy is in nixpkgs.

PS: regarding breaking changes in Immich, we're having a related discussion in #432932

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@diogotcorreia After some discussion, we're okay with keeping the pgvecto.rs code as deprecated in the initial stable release, to be removed in the next major release after November. Does this work for you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mertalev I think that's perfect, thank you so much!

Without this dependency, we may run into a race condition, especially in
our tests.

Signed-off-by: Sefa Eyeoglu <[email protected]>
@Scrumplex
Scrumplex force-pushed the nixos/immich/vectorchord branch from 15e4990 to 890b3d5 Compare August 14, 2025 20:30
hyperparabolic added a commit to hyperparabolic/nix-config that referenced this pull request Aug 16, 2025
This is mostly good to go, but things are behind in the derivation.
Immich migrated to vectorchord in place of pgvecto-rs, and that seems
to be what opened up postgres 17 support. There's already a WIP PR
for this migration: NixOS/nixpkgs#428568

Once this is merged, a few more changes are necessary after user /
service are created:
- Uncomment mediaLocation
- Create zfs dataset for postgres database, migrate initialized data
into that dataset and enable snapshots.
@Scrumplex

Copy link
Copy Markdown
Member Author

CC @dotlambda, I noticed your recent inactivity and I hope everything is alright! :D

I thought I should wait for a review from you, as they are always very detailed and of exceptional quality. If you can't find the time to review this in the next few days, I will merge this as-is, and we can iron out any potential edge cases over time.

This enables VectorChord in the database (currently) alongside
pgvecto.rs. Note that VectorChord requires pgvector, which is enabled as
well by this option.

Signed-off-by: Sefa Eyeoglu <[email protected]>
@Scrumplex
Scrumplex force-pushed the nixos/immich/vectorchord branch from 890b3d5 to a9c17c3 Compare August 19, 2025 15:56
@Scrumplex

Copy link
Copy Markdown
Member Author

@ofborg test immich

@dotlambda

Copy link
Copy Markdown
Member

@ofborg test immich-vectorchord-migration

@dotlambda
dotlambda merged commit 32991f1 into NixOS:master Aug 19, 2025
@diogotcorreia

Copy link
Copy Markdown
Member

Reminder that #429374 needs to be merged for this to be backported

@dotlambda

Copy link
Copy Markdown
Member

Reminder that #429374 needs to be merged for this to be backported

But should we really backport this given that pgvecto.rs will be supported through November?

@diogotcorreia

Copy link
Copy Markdown
Member

@dotlambda I thought the idea was to get this onto 25.05 so that we can ditch pgvecto.rs in 25.11? #428568 (comment)

How would we handle the breaking change otherwise?

@dotlambda

Copy link
Copy Markdown
Member

@dotlambda I thought the idea was to get this onto 25.05 so that we can ditch pgvecto.rs in 25.11? #428568 (comment)

I guess you're right. Anyway, backporting this PR should wait until people have tested it more.

How would we handle the breaking change otherwise?

If 25.11 never moves to an Immich version that doesn't support pgvecto.rs then people could always migrate from 25.05 to 25.11 and from there to unstable or (hopefully) 26.05.
But since Immich sometimes introduces breaking changes that require migrating to intermediate versions first (see e.g. https://github.com/immich-app/immich/releases/tag/v1.137.0) that would be risky.

@h7x4 h7x4 added the 8.has: tests This PR has tests label Sep 11, 2025
@nixpkgs-ci

nixpkgs-ci Bot commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

Backport failed for release-25.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-25.05
git worktree add -d .worktree/backport-428568-to-release-25.05 origin/release-25.05
cd .worktree/backport-428568-to-release-25.05
git switch --create backport-428568-to-release-25.05
git cherry-pick -x 1a244577826a5bb1aedcf2eb3350095320ccfb1a fd1994a8b7b262f57ba2d7647c32fd5fd23425b7 0b93bf6c2200343b6c5c6b5ecbca04c92c35e7f0 a9c17c34b1caa83a097177eb003604755a19d404

@diogotcorreia

Copy link
Copy Markdown
Member

I'll do the backport manually

@diogotcorreia diogotcorreia added the 8.has: port to stable This PR already has a backport to the stable release. label Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: port to stable This PR already has a backport to the stable release. 8.has: tests This PR has tests 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants