nixos/immich: drop pgvecto-rs support
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -136,6 +136,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.
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -771,7 +771,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()
|
||||
'';
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user