postgresqlPackages.pgvecto-rs: drop (#499611)

This commit is contained in:
dotlambda
2026-03-14 14:59:48 +00:00
committed by GitHub
14 changed files with 53 additions and 343 deletions
-6
View File
@@ -718,12 +718,6 @@
"module-services-suwayomi-server-extra-config": [
"index.html#module-services-suwayomi-server-extra-config"
],
"module-services-immich": [
"index.html#module-services-immich"
],
"module-services-immich-vectorchord-migration": [
"index.html#module-services-immich-vectorchord-migration"
],
"module-services-paisa": [
"index.html#module-services-paisa"
],
@@ -382,7 +382,7 @@
- `linux_libre` & `linux_latest_libre` have been removed due to a lack of maintenance.
- Immich now has support for [VectorChord](https://github.com/tensorchord/VectorChord) when using the PostgreSQL configuration provided by `services.immich.database.enable`, which replaces `pgvecto-rs`. VectorChord support can be toggled with the option `services.immich.database.enableVectorChord`. Additionally, `pgvecto-rs` support is now disabled from NixOS 25.11 onwards using the option `services.immich.database.enableVectors`. This option will be removed fully in the future once Immich drops support for `pgvecto-rs` fully. See [Immich migration instructions](#module-services-immich-vectorchord-migration).
- Immich now has support for [VectorChord](https://github.com/tensorchord/VectorChord) when using the PostgreSQL configuration provided by `services.immich.database.enable`, which replaces `pgvecto-rs`. VectorChord support can be toggled with the option `services.immich.database.enableVectorChord`. Additionally, `pgvecto-rs` support is now disabled from NixOS 25.11 onwards using the option `services.immich.database.enableVectors`. This option will be removed fully in the future once Immich drops support for `pgvecto-rs` fully. See [Immich migration instructions](https://github.com/NixOS/nixpkgs/blob/nixos-25.11/nixos/modules/services/web-apps/immich.md#migrating-from-pgvecto-rs-to-vectorchord-pre-2511-installations-module-services-immich-vectorchord-migration).
- It is now possible to configure the default source address using the new options [networking.defaultGateway.source](#opt-networking.defaultGateway.source),
[networking.defaultGateway6.source](#opt-networking.defaultGateway6.source).
@@ -138,6 +138,10 @@ of pulling the upstream container image from Docker Hub. If you want the old beh
- Ethercalc and its associated module have been removed, as the package is unmaintained and cannot be installed from source with npm now.
- `services.immich` no longer supports pgvecto.rs since the package has been removed from nixpkgs.
As a result, options `services.immich.database.enableVectors` and `services.immich.database.enableVectorchord` have been removed, and VectorChord is now always used.
If you have not completed the migration yet, ensure you completely remove the extension from your database before upgrading by following the [migration guide](https://github.com/NixOS/nixpkgs/blob/nixos-25.11/nixos/modules/services/web-apps/immich.md#migrating-from-pgvecto-rs-to-vectorchord-pre-2511-installations-module-services-immich-vectorchord-migration).
- `services.cgit` before always had the git-http-backend and its "export all" setting enabled, which sidestepped any access control configured in cgit's settings. Now you have to make a decision and either enable or disable `services.cgit.gitHttpBackend.checkExportOkFiles` (or disable the git-http-backend).
- `rocmPackages_6` has been removed. `rocmPackages` has been updated to ROCm 7.x. Out of tree packages may rely on obsolete hipblas APIs or compile time constant warp size and need to be updated.
-32
View File
@@ -1,32 +0,0 @@
# Immich {#module-services-immich}
[Immich](https://immich.app/) is a self-hosted photo and video management
solution, similar to SaaS offerings like Google Photos.
## Migrating from `pgvecto-rs` to VectorChord (pre-25.11 installations) {#module-services-immich-vectorchord-migration}
Immich instances that were setup before 25.11 (as in
`system.stateVersion = 25.11;`) will be automatically migrated to VectorChord.
Note that this migration is not reversible, so database dumps should be created
if desired.
See [Immich documentation][vectorchord-migration-docs] for more details about
the automatic migration.
After a successful migration, `pgvecto-rs` should be removed from the database
installation, unless other applications depend on it.
1. Make sure VectorChord is enabled ([](#opt-services.immich.database.enableVectorChord)) and Immich has completed the migration. Refer to the [Immich documentation][vectorchord-migration-docs] for details.
2. Run the following two statements in the PostgreSQL database using a superuser role in Immich's database.
```sql
DROP EXTENSION vectors;
DROP SCHEMA vectors;
```
- You may use the following command to run these statements against the database: `sudo -u postgres psql immich` (Replace `immich` with the value of [](#opt-services.immich.database.name))
3. Disable `pgvecto-rs` by setting [](#opt-services.immich.database.enableVectors) to `false`.
4. Rebuild and switch.
[vectorchord-migration-docs]: https://immich.app/docs/administration/postgres-standalone/#migrating-to-vectorchord
+46 -65
View File
@@ -69,6 +69,30 @@ in
`services.immich.settings.oauth.clientSecret._secret = "/path/to/secret/file";`
''
)
(lib.mkRemovedOptionModule
[
"services"
"immich"
"database"
"enableVectorChord"
]
''
`database.enableVectorChord` has been deprecated as the pgvecto.rs alternative
is no longer available. From now on, vectorchord is always enabled.
''
)
(lib.mkRemovedOptionModule
[
"services"
"immich"
"database"
"enableVectors"
]
''
`database.enableVectors` has been deprecated as pgvecto.rs is no longer available.
From now on, vectorchord is used instead.
''
)
];
options.services.immich = {
@@ -203,17 +227,6 @@ in
// {
default = true;
};
enableVectorChord =
mkEnableOption "the new VectorChord extension for full-text search in Postgres"
// {
default = true;
};
enableVectors =
mkEnableOption "pgvecto.rs in the database. You may disable this, if you have migrated to VectorChord and deleted the `vectors` schema."
// {
default = lib.versionOlder config.system.stateVersion "25.11";
defaultText = lib.literalExpression "lib.versionOlder config.system.stateVersion \"25.11\"";
};
createDB = mkEnableOption "the automatic creation of the database for immich." // {
default = true;
};
@@ -263,17 +276,6 @@ in
assertion = !isPostgresUnixSocket -> cfg.secretsFile != null;
message = "A secrets file containing at least the database password must be provided when unix sockets are not used.";
}
{
# When removing this assertion, please adjust the nixosTests accordingly.
assertion =
(cfg.database.enable && cfg.database.enableVectors)
-> lib.versionOlder config.services.postgresql.package.version "17";
message = "Immich doesn't support PostgreSQL 17+ when using pgvecto.rs. Consider disabling it using services.immich.database.enableVectors if it is not needed anymore.";
}
{
assertion = cfg.database.enable -> (cfg.database.enableVectorChord || cfg.database.enableVectors);
message = "At least one of services.immich.database.enableVectorChord and services.immich.database.enableVectors has to be enabled.";
}
];
services.postgresql = mkIf cfg.database.enable {
@@ -286,19 +288,12 @@ in
ensureClauses.login = true;
}
];
extensions =
ps:
lib.optionals cfg.database.enableVectors [ ps.pgvecto-rs ]
++ lib.optionals cfg.database.enableVectorChord [
ps.pgvector
ps.vectorchord
];
extensions = ps: [
ps.pgvector
ps.vectorchord
];
settings = {
shared_preload_libraries =
lib.optionals cfg.database.enableVectors [
"vectors.so"
]
++ lib.optionals cfg.database.enableVectorChord [ "vchord.so" ];
shared_preload_libraries = [ "vchord.so" ];
search_path = "\"$user\", public, vectors";
};
};
@@ -310,40 +305,27 @@ in
"cube"
"earthdistance"
"pg_trgm"
]
++ lib.optionals cfg.database.enableVectors [
"vectors"
]
++ lib.optionals cfg.database.enableVectorChord [
"vector"
"vchord"
];
sqlFile = pkgs.writeText "immich-pgvectors-setup.sql" (
# save previous version of vectorchord to trigger reindex on update
lib.optionalString cfg.database.enableVectorChord ''
SELECT COALESCE(installed_version, ''') AS vchord_version_before FROM pg_available_extensions WHERE name = 'vchord' \gset
''
+ ''
${lib.concatMapStringsSep "\n" (ext: "CREATE EXTENSION IF NOT EXISTS \"${ext}\";") extensions}
${lib.concatMapStringsSep "\n" (ext: "ALTER EXTENSION \"${ext}\" UPDATE;") extensions}
ALTER SCHEMA public OWNER TO ${cfg.database.user};
''
+ lib.optionalString cfg.database.enableVectors ''
ALTER SCHEMA vectors OWNER TO ${cfg.database.user};
GRANT SELECT ON TABLE pg_vector_index_stat TO ${cfg.database.user};
''
# trigger reindex if vectorchord updates
# https://docs.immich.app/administration/postgres-standalone/#updating-vectorchord
+ lib.optionalString cfg.database.enableVectorChord ''
SELECT COALESCE(installed_version, ''') AS vchord_version_after FROM pg_available_extensions WHERE name = 'vchord' \gset
sqlFile = pkgs.writeText "immich-pgvectors-setup.sql" ''
-- save previous version of vectorchord to trigger reindex on update
SELECT COALESCE(installed_version, ''') AS vchord_version_before FROM pg_available_extensions WHERE name = 'vchord' \gset
SELECT (:'vchord_version_before' != ''' AND :'vchord_version_before' != :'vchord_version_after') AS has_vchord_updated \gset
\if :has_vchord_updated
REINDEX INDEX face_index;
REINDEX INDEX clip_index;
\endif
''
);
${lib.concatMapStringsSep "\n" (ext: "CREATE EXTENSION IF NOT EXISTS \"${ext}\";") extensions}
${lib.concatMapStringsSep "\n" (ext: "ALTER EXTENSION \"${ext}\" UPDATE;") extensions}
ALTER SCHEMA public OWNER TO ${cfg.database.user};
-- trigger reindex if vectorchord updates
-- https://docs.immich.app/administration/postgres-standalone/#updating-vectorchord
SELECT COALESCE(installed_version, ''') AS vchord_version_after FROM pg_available_extensions WHERE name = 'vchord' \gset
SELECT (:'vchord_version_before' != ''' AND :'vchord_version_before' != :'vchord_version_after') AS has_vchord_updated \gset
\if :has_vchord_updated
REINDEX INDEX face_index;
REINDEX INDEX clip_index;
\endif
'';
in
[
''
@@ -480,6 +462,5 @@ in
};
meta = {
maintainers = with lib.maintainers; [ jvanbruegge ];
doc = ./immich.md;
};
}
-1
View File
@@ -772,7 +772,6 @@ in
immich = runTest ./web-apps/immich.nix;
immich-kiosk = runTest ./web-apps/immich-kiosk.nix;
immich-public-proxy = runTest ./web-apps/immich-public-proxy.nix;
immich-vectorchord-migration = runTest ./web-apps/immich-vectorchord-migration.nix;
immich-vectorchord-reindex = runTest ./web-apps/immich-vectorchord-reindex.nix;
immichframe = runTest ./web-apps/immichframe.nix;
incron = runTest ./incron.nix;
@@ -1,71 +0,0 @@
{ ... }:
{
name = "immich-vectorchord-migration";
nodes.machine =
{ lib, pkgs, ... }:
{
# These tests need a little more juice
virtualisation = {
cores = 2;
memorySize = 2048;
diskSize = 4096;
};
environment.systemPackages = with pkgs; [ immich-cli ];
services.immich = {
enable = true;
environment.IMMICH_LOG_LEVEL = "verbose";
# Simulate an existing setup
database.enableVectorChord = lib.mkDefault false;
database.enableVectors = lib.mkDefault true;
};
# TODO: Remove when PostgreSQL 17 is supported.
services.postgresql.package = pkgs.postgresql_16;
specialisation."immich-vectorchord-enabled".configuration = {
services.immich.database.enableVectorChord = true;
};
specialisation."immich-vectorchord-only".configuration = {
services.immich.database = {
enableVectorChord = true;
enableVectors = false;
};
};
};
testScript =
{ nodes, ... }:
let
specBase = "${nodes.machine.system.build.toplevel}/specialisation";
vectorchordEnabled = "${specBase}/immich-vectorchord-enabled";
vectorchordOnly = "${specBase}/immich-vectorchord-only";
in
''
def psql(command: str):
machine.succeed(f"sudo -u postgres psql -d ${nodes.machine.services.immich.database.name} -c '{command}'")
def immich_works():
machine.wait_for_unit("immich-server.service")
machine.wait_for_open_port(2283) # Server
machine.wait_for_open_port(3003) # Machine learning
machine.succeed("curl --fail http://localhost:2283/")
immich_works()
machine.succeed("${vectorchordEnabled}/bin/switch-to-configuration test")
immich_works()
psql("DROP EXTENSION vectors;")
psql("DROP SCHEMA vectors;")
machine.succeed("${vectorchordOnly}/bin/switch-to-configuration test")
immich_works()
'';
}
+1 -1
View File
@@ -224,7 +224,7 @@ stdenv.mkDerivation (finalAttrs: {
passthru = {
tests = {
inherit (nixosTests) immich immich-vectorchord-migration immich-vectorchord-reindex;
inherit (nixosTests) immich immich-vectorchord-reindex;
};
machine-learning = immich-machine-learning.override {
@@ -1,11 +1,5 @@
# nixpkgs-update: no auto update
{
cargo-pgrx_0_12_0_alpha_1 = {
version = "0.12.0-alpha.1";
hash = "sha256-0m9oaqjU42RYyttkTihADDrRMjr2WoK/8sInZALeHws=";
cargoHash = "sha256-zYjqE7LZLnTaVxWAPWC1ncEjCMlrhy4THtgecB7wBYY=";
};
cargo-pgrx_0_12_6 = {
version = "0.12.6";
hash = "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA=";
+1
View File
@@ -23,4 +23,5 @@ in
// lib.optionalAttrs config.allowAliases {
cstore_fdw = throw "PostgreSQL extension `cstore_fdw` has been removed due to being broken for more than a year; see RFC 180"; # Added 2026-02-05
pg_embedding = throw "PostgreSQL extension `pg_embedding` has been removed since the project has been abandoned. Upstream's recommendation is to use pgvector instead (https://neon.tech/docs/extensions/pg_embedding#migrate-from-pg_embedding-to-pgvector)";
pgvecto-rs = throw "PostgreSQL extension `pgvecto-rs` has been removed since the project has been abandoned. Upstream's recommendation is to use vectorchord instead (https://docs.vectorchord.ai/vectorchord/admin/migration.html#from-pgvecto-rs) "; # Added 2026-03-13
}
@@ -1,19 +0,0 @@
diff --git a/crates/c/build.rs b/crates/c/build.rs
index 8d822e5..8b7e371 100644
--- a/crates/c/build.rs
+++ b/crates/c/build.rs
@@ -1,9 +1,13 @@
fn main() {
println!("cargo:rerun-if-changed=src/f16.h");
println!("cargo:rerun-if-changed=src/f16.c");
+ println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
cc::Build::new()
- .compiler("clang-16")
+ .compiler("@clang@")
.file("./src/f16.c")
+ // read env var set by rustPlatform.bindgenHook
+ .try_flags_from_environment("BINDGEN_EXTRA_CLANG_ARGS")
+ .expect("the BINDGEN_EXTRA_CLANG_ARGS environment variable must be specified and UTF-8")
.opt_level(3)
.debug(true)
.compile("vectorsc");
@@ -1,21 +0,0 @@
diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs
index 18172b9..6fc7e82 100644
--- a/crates/common/src/lib.rs
+++ b/crates/common/src/lib.rs
@@ -1,3 +1,4 @@
+#![warn(dangerous_implicit_autorefs)]
pub mod clean;
pub mod dir_ops;
pub mod file_atomic;
diff --git a/src/lib.rs b/src/lib.rs
index 068c65d..82609e9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,6 +6,7 @@
#![allow(clippy::needless_range_loop)]
#![allow(clippy::single_match)]
#![allow(clippy::too_many_arguments)]
+#![warn(dangerous_implicit_autorefs)]
mod bgworker;
mod datatype;
@@ -1,119 +0,0 @@
{
buildPgrxExtension,
cargo-pgrx_0_12_0_alpha_1,
clang,
fetchFromGitHub,
lib,
nix-update-script,
openssl,
pkg-config,
postgresql,
postgresqlTestExtension,
replaceVars,
}:
buildPgrxExtension (finalAttrs: {
inherit postgresql;
cargo-pgrx = cargo-pgrx_0_12_0_alpha_1;
pname = "pgvecto-rs";
version = "0.3.0";
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
patches = [
# Tell the `c` crate to use the flags from the rust bindgen hook
(replaceVars ./0001-read-clang-flags-from-environment.diff {
clang = lib.getExe clang;
})
# Rust 1.89 denies implicit autorefs by default, making the compilation fail.
# This restores the behaviour of previous rust versions by making the lint throw a warning instead.
./0002-allow-dangerous-implicit-autorefs.diff
];
src = fetchFromGitHub {
owner = "tensorchord";
repo = "pgvecto.rs";
tag = "v${finalAttrs.version}";
hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE=";
};
cargoHash = "sha256-8otJ1uqGrCmlxAqvfAL3OjhBI4I6dAu6EoajstO46Sw=";
# Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL
postPatch = ''
substituteInPlace ./vectors.control --subst-var-by CARGO_VERSION ${finalAttrs.version}
'';
# Include upgrade scripts in the final package
# https://github.com/tensorchord/pgvecto.rs/blob/v0.2.0/scripts/ci_package.sh#L6-L8
postInstall = ''
cp sql/upgrade/* $out/share/postgresql/extension/
'';
env = {
# Needed to get openssl-sys to use pkg-config.
OPENSSL_NO_VENDOR = 1;
# Bypass rust nightly features not being available on rust stable
RUSTC_BOOTSTRAP = 1;
};
# This crate does not have the "pg_test" feature
usePgTestCheckFeature = false;
passthru = {
updateScript = nix-update-script { };
tests.extension = postgresqlTestExtension {
inherit (finalAttrs) finalPackage;
postgresqlExtraSettings = ''
shared_preload_libraries='vectors'
'';
sql = ''
CREATE EXTENSION vectors;
CREATE TABLE items (
id bigserial PRIMARY KEY,
content text NOT NULL,
embedding vectors.vector(3) NOT NULL -- 3 dimensions
);
INSERT INTO items (content, embedding) VALUES
('a fat cat sat on a mat and ate a fat rat', '[1, 2, 3]'),
('a fat dog sat on a mat and ate a fat rat', '[4, 5, 6]'),
('a thin cat sat on a mat and ate a thin rat', '[7, 8, 9]'),
('a thin dog sat on a mat and ate a thin rat', '[10, 11, 12]');
'';
asserts = [
{
query = "SELECT default_version FROM pg_available_extensions WHERE name = 'vectors'";
expected = "'${finalAttrs.version}'";
description = "Extension vectors has correct version.";
}
{
query = "SELECT COUNT(embedding) FROM items WHERE to_tsvector('english', content) @@ 'cat & rat'::tsquery";
expected = "2";
description = "Stores and returns vectors.";
}
];
};
};
meta = {
# Upstream removed support for PostgreSQL 13 on 0.3.0: https://github.com/tensorchord/pgvecto.rs/issues/343
broken =
(lib.versionOlder postgresql.version "14")
||
# PostgreSQL 17 support issue upstream: https://github.com/tensorchord/pgvecto.rs/issues/607
# Check after next package update.
lib.versionAtLeast postgresql.version "17" && finalAttrs.version == "0.3.0";
description = "Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres";
homepage = "https://github.com/tensorchord/pgvecto.rs";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
diogotcorreia
esclear
];
};
})
-1
View File
@@ -4683,7 +4683,6 @@ with pkgs;
defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { };
inherit (callPackages ../development/tools/rust/cargo-pgrx { })
cargo-pgrx_0_12_0_alpha_1
cargo-pgrx_0_12_6
cargo-pgrx_0_16_0
cargo-pgrx_0_16_1