diff --git a/modules/server/containers/apps/immich.nix b/modules/server/containers/apps/immich.nix index 6d83f94..0b8b456 100644 --- a/modules/server/containers/apps/immich.nix +++ b/modules/server/containers/apps/immich.nix @@ -1,3 +1,57 @@ -{...}:{ - +{ config, containerCfg, pkgs, lib, builder, name,... }: +let + serverCfg = config.syscfg.server; + + immichServerImage = pkgs.dockerTools.pullImage { + imageName = "ghcr.io/immich-app/immich-server"; + imageDigest = "sha256:d5cb251d7c3bcbb8e5bb974c8de53f3e1f0efcb71e21bde1b66df872a0a2df3d"; + sha256 = "0000000000000000000000000000000000000000000000000000"; + }; + immichMachineLearningImage = pkgs.dockerTools.pullImage { + imageName = "ghcr.io/immich-app/immich-machine-learning"; + imageDigest = "sha256:4a25fdcd11c13bc33e8b4e7eef118bc23dbd4df012012ec6d7fb1eeef872ad4d"; + sha256 = "0000000000000000000000000000000000000000000000000000"; + }; + +in { + sops = false; + db = true; + + paths = [{ + path = "${serverCfg.configPath}/immich/cache"; + mode = "0750"; + }{ + path = "${serverCfg.dataPath}/immich/"; + mode = "0750"; + }]; + + containers = { + server = builder.mkContainer { + subdomain = containerCfg.subdomain; + imageStream = immichServerImage; + port = 2283; + secret = name; + extraEnv = { + DB_URL = "postgresql://immich_user:\${DB_PASS}@${builder.host}/immich_db"; + IMMICH_MACHINE_LEARNING_URL = "http://immich-ml:3003"; + REDIS_HOSTNAME = builder.host; + }; + overrides = { + volumes = [ + "${serverCfg.dataPath}/immich:/usr/src/upload" + ]; + }; + }; + + immich-ml = builder.mkContainer { + imageStream = immichMachineLearningImage; + port = 3003; + overrides = { + volumes = [ + "${serverCfg.configPath}/immich/cache:/cache" + ]; + }; + }; + }; + } \ No newline at end of file