nixos/immich: only start after reaching postgres.target

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

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2025-08-14 22:30:00 +02:00
parent 143d9422eb
commit 1a24457782
+4 -2
View File
@@ -335,7 +335,8 @@ in
systemd.services.immich-server = {
description = "Immich backend server (Self-hosted photo and video backup solution)";
after = [ "network.target" ];
requires = lib.mkIf cfg.database.enable [ "postgresql.target" ];
after = [ "network.target" ] ++ lib.optionals cfg.database.enable [ "postgresql.target" ];
wantedBy = [ "multi-user.target" ];
inherit (cfg) environment;
path = [
@@ -362,7 +363,8 @@ in
systemd.services.immich-machine-learning = mkIf cfg.machine-learning.enable {
description = "immich machine learning";
after = [ "network.target" ];
requires = lib.mkIf cfg.database.enable [ "postgresql.target" ];
after = [ "network.target" ] ++ lib.optionals cfg.database.enable [ "postgresql.target" ];
wantedBy = [ "multi-user.target" ];
inherit (cfg.machine-learning) environment;
serviceConfig = commonServiceConfig // {