Add declaritive immich config

This commit is contained in:
Yan Lin 2025-09-07 20:35:48 +02:00
parent c18f0adb88
commit b41aac2041
3 changed files with 258 additions and 0 deletions

View file

@ -1,5 +1,15 @@
{ config, pkgs, lib, ... }:
let
# Import Immich configuration from declarative config file
immichConfig = import ../config/immich.nix;
# Convert Nix configuration to JSON string
immichConfigJson = builtins.toJSON immichConfig;
# Write config file to a location accessible by the container
immichConfigFile = pkgs.writeText "immich.json" immichConfigJson;
in
{
# Container virtualization with Podman
virtualisation = {
@ -51,19 +61,26 @@
"/var/lib/containers/immich/config:/config"
"/mnt/storage/appbulk/immich:/photos"
"/mnt/storage/Media/DCIM:/libraries"
# Mount the declarative config file
"${immichConfigFile}:/config/immich.json:ro"
];
environment = {
PUID = "1000";
PGID = "100";
TZ = "Europe/Copenhagen";
# Point to the mounted config file
IMMICH_CONFIG_FILE = "/config/immich.json";
# Database connection (keep as env vars for security)
DB_HOSTNAME = "immich-db";
DB_USERNAME = "postgres";
DB_PASSWORD = "postgres";
DB_DATABASE_NAME = "postgres";
DB_PORT = "5432";
# Redis connection
REDIS_HOSTNAME = "immich-redis";
REDIS_PORT = "6379";
# Machine Learning server (internal)
MACHINE_LEARNING_HOST = "0.0.0.0";
MACHINE_LEARNING_PORT = "3003";
MACHINE_LEARNING_WORKERS = "1";