diff --git a/hosts/isengard.nix b/hosts/isengard.nix index 8f119c6..ac1097f 100644 --- a/hosts/isengard.nix +++ b/hosts/isengard.nix @@ -20,6 +20,7 @@ ../modules/containers/ai.nix ../modules/containers/jitsi.nix ../modules/containers/radarr.nix + ../modules/containers/immich.nix ]; # Disks diff --git a/modules/containers/immich.nix b/modules/containers/immich.nix new file mode 100644 index 0000000..56cb268 --- /dev/null +++ b/modules/containers/immich.nix @@ -0,0 +1,82 @@ +{ config, ... }: + +let + workDir = "/srv/containers/immich"; + dataDir = "/srv/data/immich"; + nextcloudDir = "/srv/data/nextcloud"; +in +{ + systemd.tmpfiles.rules = [ + "d ${workDir}/cache 2770 root admin" + "d ${workDir}/postgres 0700 999 999" + "d ${dataDir} 2770 root admin" + ]; + + virtualisation.oci-containers.containers = { + immich = { + autoStart = true; + image = "ghcr.io/immich-app/immich-server:v2"; + + ports = [ + "0.0.0.0:10008:2283" + ]; + + volumes = [ + "${dataDir}:/usr/src/app/upload" + "${nextcloudDir}:/external/nextcloud:ro" + ]; + + environment = { + TZ = "Europe/Bucharest"; + DB_HOSTNAME = "immich-db"; + REDIS_HOSTNAME = "immich-redis"; + IMMICH_MACHINE_LEARNING_URL = "http://immich-machine-learning:3003"; + #DB_STORAGE_TYPE: "HDD"; + }; + + environmentFiles = [ + config.age.secrets.immich.path + ]; + + extraOptions = [ + "--group-add=10000" + ]; + + dependsOn = [ + "immich-db" + "immich-redis" + "immich-machine-learning" + ]; + }; + + immich-machine-learning = { + autoStart = true; + + image = "ghcr.io/immich-app/immich-machine-learning:v2"; + + volumes = [ + "${workDir}/cache:/cache" + ]; + }; + + immich-redis = { + autoStart = true; + + image = "redis:8-alpine"; + }; + + immich-db = { + autoStart = true; + + image = "ghcr.io/immich-app/postgres:17-vectorchord0.5.3"; + + environmentFiles = [ + config.age.secrets.immich-db.path + ]; + + volumes = [ + "${workDir}/postgres:/var/lib/postgresql/data" + ]; + }; + }; +} diff --git a/modules/containers/nextcloud.nix b/modules/containers/nextcloud.nix index 2ea92a9..e24c7ad 100644 --- a/modules/containers/nextcloud.nix +++ b/modules/containers/nextcloud.nix @@ -8,7 +8,7 @@ in systemd.tmpfiles.rules = [ "d ${workDir}/html 2700 33 33" "d ${workDir}/db 2700 999 999" - "d ${dataDir} 2700 victor admin" + "d ${dataDir} 2770 33 admin" ]; virtualisation.oci-containers.containers = {