93 lines
2.6 KiB
Nix
93 lines
2.6 KiB
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
rootCfg = config.selfhosted;
|
|
moduleCfg = rootCfg.immich;
|
|
cfg = moduleCfg.ml;
|
|
domain = config.sops.placeholder."domains/serv";
|
|
mailDomain = "${rootCfg.mail.stalwart.subdomain}.${domain}";
|
|
pocketIdDomain = "${rootCfg.pocket-id.subdomain}.${domain}";
|
|
smtpUser = "noreply@${domain}";
|
|
in
|
|
{
|
|
config = mkIf moduleCfg.enable {
|
|
sops.templates."immich.env".content = ''
|
|
DB_PASSWORD=${config.sops.placeholder."immich/db_password"}
|
|
IMMICH_CONFIG_FILE=/app/immich-config.json
|
|
'';
|
|
|
|
sops.templates."immich-config.json".content = ''
|
|
{
|
|
"backup": {
|
|
"database": {
|
|
"cronExpression": "0 */4 * * *",
|
|
"enabled": true,
|
|
"keepLastAmount": 4
|
|
}
|
|
},
|
|
"notifications": {
|
|
"smtp": {
|
|
"enabled": true,
|
|
"from": "${smtpUser}",
|
|
"replyTo": "",
|
|
"transport": {
|
|
"host": "${mailDomain}",
|
|
"ignoreCert": false,
|
|
"username": "${smtpUser}",
|
|
"password": "${config.sops.placeholder."vaultwarden/smtp_password"}",
|
|
"secure": true,
|
|
"port": 465
|
|
}
|
|
}
|
|
},
|
|
"oauth": {
|
|
"enabled": true,
|
|
"clientId": "immich",
|
|
"clientSecret": "${config.sops.placeholder."immich/client_secret"}",
|
|
"autoLaunch": true,
|
|
"autoRegister": true,
|
|
"buttonText": "Login with Pocket-ID",
|
|
"defaultStorageQuota": 1,
|
|
"issuerUrl": "https://${pocketIdDomain}",
|
|
"roleClaim": "immich_role",
|
|
"storageQuotaClaim": "immich_quota"
|
|
},
|
|
"passwordLogin": {
|
|
"enabled": true
|
|
},
|
|
"machineLearning": {
|
|
"enabled": true,
|
|
"availabilityChecks": {
|
|
"enabled": true,
|
|
"interval": 30000,
|
|
"timeout": 2000
|
|
},
|
|
"clip": {
|
|
"enabled": true,
|
|
"modelName": "ViT-B-32__openai"
|
|
},
|
|
"duplicateDetection": {
|
|
"enabled": true,
|
|
"maxDistance": 0.01
|
|
},
|
|
"facialRecognition": {
|
|
"enabled": true,
|
|
"modelName": "buffalo_l",
|
|
"maxDistance": 0.5,
|
|
"minFaces": 3,
|
|
"minScore": 0.7
|
|
},
|
|
"ocr": {
|
|
"enabled": true,
|
|
"modelName": "ESLAV__PP-OCRv5_mobile",
|
|
"maxResolution": 736,
|
|
"minDetectionScore": 0.5,
|
|
"minRecognitionScore": 0.8
|
|
},
|
|
"urls": ["http://${cfg.name}:3003"]
|
|
}
|
|
}
|
|
'';
|
|
};
|
|
}
|