nixos-configs/devices/nos/modules/docker/immich/compose.nix

85 lines
1.8 KiB
Nix
Raw Permalink Normal View History

2024-07-24 15:49:31 -04:00
{
config,
pkgs,
...
}: let
inherit (config.sops) secrets;
2024-07-24 15:49:31 -04:00
inherit (config.khepri) rwDataDir;
2024-02-19 12:42:02 -05:00
rwPath = rwDataDir + "/immich";
UPLOAD_LOCATION = "${rwPath}/data";
in {
khepri.compositions."immich" = {
networks.proxy_net = {external = true;};
2024-02-19 12:42:02 -05:00
services = {
"immich_server" = {
image = import ./images/server.nix pkgs;
environmentFiles = [
"${./env}"
secrets.immich.path
];
2024-02-19 12:42:02 -05:00
volumes = [
"${UPLOAD_LOCATION}:/usr/src/app/upload:rw"
];
ports = [
"2283:2283"
];
networks = ["proxy_net"];
2024-02-19 12:42:02 -05:00
dependsOn = ["immich_redis" "immich_postgres"];
restart = "always";
2024-02-19 12:42:02 -05:00
environment.NODE_ENV = "production";
};
2024-02-19 12:42:02 -05:00
"immich_machine_learning" = {
image = import ./images/machine-learning.nix pkgs;
restart = "always";
environmentFiles = [
"${./env}"
secrets.immich.path
];
networks = ["proxy_net"];
2024-02-19 12:42:02 -05:00
volumes = [
"${rwPath}/cache:/cache"
];
};
"immich_redis" = {
image = import ./images/redis.nix pkgs;
restart = "always";
tmpfs = ["/data"];
environmentFiles = [
"${./env}"
secrets.immich.path
];
networks = ["proxy_net"];
};
2024-02-19 12:42:02 -05:00
"immich_postgres" = {
image = import ./images/postgres.nix pkgs;
restart = "always";
environmentFiles = [
"${./env}"
secrets.immich.path
];
networks = ["proxy_net"];
2024-02-19 12:42:02 -05:00
volumes = [
"${rwPath}/db:/var/lib/postgresql/data"
];
2024-02-19 12:42:02 -05:00
environment = {
POSTGRES_PASSWORD = "\${DB_PASSWORD}";
POSTGRES_USER = "\${DB_USERNAME}";
POSTGRES_DB = "\${DB_DATABASE_NAME}";
};
2024-02-19 12:42:02 -05:00
};
};
};
}