update immich
This commit is contained in:
114
immich.nix
114
immich.nix
@@ -6,50 +6,56 @@ let
|
||||
immich_data_dir = "/mnt/storage/immich";
|
||||
|
||||
volumeServices = names: (
|
||||
lib.lists.foldl (services: name:
|
||||
services // {
|
||||
"podman-volume-immich_${name}" = {
|
||||
path = [ pkgs.podman ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
lib.lists.foldl
|
||||
(services: name:
|
||||
services // {
|
||||
"podman-volume-immich_${name}" = {
|
||||
path = [ pkgs.podman ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
podman volume inspect immich_${name} || podman volume create immich_${name}
|
||||
'';
|
||||
partOf = [ "podman-compose-immich-root.target" ];
|
||||
wantedBy = [ "podman-compose-immich-root.target" ];
|
||||
};
|
||||
script = ''
|
||||
podman volume inspect immich_${name} || podman volume create immich_${name}
|
||||
'';
|
||||
partOf = [ "podman-compose-immich-root.target" ];
|
||||
wantedBy = [ "podman-compose-immich-root.target" ];
|
||||
};
|
||||
}
|
||||
) {} names
|
||||
}
|
||||
)
|
||||
{ }
|
||||
names
|
||||
);
|
||||
|
||||
containerServices = services: (
|
||||
lib.lists.foldl (acc: { name, volumes ? [], ... }:
|
||||
let
|
||||
volume_services = map (volume: "podman-volume-immich_${volume}.service") volumes;
|
||||
dependent_services = [ "podman-network-immich_default.service" ] ++ volume_services;
|
||||
in
|
||||
lib.lists.foldl
|
||||
(acc: { name, volumes ? [ ], ... }:
|
||||
let
|
||||
volume_services = map (volume: "podman-volume-immich_${volume}.service") volumes;
|
||||
dependent_services = [ "podman-network-immich_default.service" ] ++ volume_services;
|
||||
in
|
||||
|
||||
acc // {
|
||||
"podman-immich_${name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
acc // {
|
||||
"podman-immich_${name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
};
|
||||
after = dependent_services;
|
||||
requires = dependent_services;
|
||||
partOf = [
|
||||
"podman-compose-immich-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-immich-root.target"
|
||||
];
|
||||
};
|
||||
after = dependent_services;
|
||||
requires = dependent_services;
|
||||
partOf = [
|
||||
"podman-compose-immich-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-immich-root.target"
|
||||
];
|
||||
};
|
||||
}
|
||||
)
|
||||
{} services
|
||||
}
|
||||
)
|
||||
{ }
|
||||
services
|
||||
);
|
||||
in {
|
||||
in
|
||||
{
|
||||
# Containers
|
||||
virtualisation.oci-containers.containers = {
|
||||
"immich_machine_learning" = {
|
||||
@@ -67,28 +73,6 @@ in {
|
||||
];
|
||||
};
|
||||
|
||||
"immich_microservices" = {
|
||||
image = "ghcr.io/immich-app/immich-server:${immich_version}";
|
||||
environmentFiles = [
|
||||
"/var/secrets/immich.env"
|
||||
];
|
||||
volumes = [
|
||||
"/etc/localtime:/etc/localtime:ro"
|
||||
"${immich_data_dir}:/usr/src/app/upload:rw"
|
||||
"${storage_dir}:${storage_dir}:ro"
|
||||
];
|
||||
cmd = [ "start.sh" "microservices" ];
|
||||
dependsOn = [
|
||||
"immich_postgres"
|
||||
"immich_redis"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=immich-microservices"
|
||||
"--network=immich_default"
|
||||
];
|
||||
};
|
||||
|
||||
"immich_postgres" = {
|
||||
image = "registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0";
|
||||
environmentFiles = [
|
||||
@@ -133,7 +117,6 @@ in {
|
||||
ports = [
|
||||
"2283:3001/tcp"
|
||||
];
|
||||
cmd = [ "start.sh" "immich" ];
|
||||
dependsOn = [
|
||||
"immich_postgres"
|
||||
"immich_redis"
|
||||
@@ -151,7 +134,6 @@ in {
|
||||
{ name = "postgres"; volumes = [ "db_data" ]; }
|
||||
{ name = "redis"; }
|
||||
{ name = "server"; }
|
||||
{ name = "microservices"; }
|
||||
]) // {
|
||||
# Networks
|
||||
"podman-network-immich_default" = {
|
||||
@@ -191,11 +173,13 @@ in {
|
||||
fileSystems."${immich_data_dir}" = {
|
||||
device = "//u407959.your-storagebox.de/backup/immich";
|
||||
fsType = "cifs";
|
||||
options = let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,auto,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
options =
|
||||
let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,auto,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
|
||||
in ["${automount_opts},credentials=/var/secrets/smb-storage"];
|
||||
in
|
||||
[ "${automount_opts},credentials=/var/secrets/smb-storage" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.cifs-utils ];
|
||||
|
||||
Reference in New Issue
Block a user