-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimmich.nix
More file actions
146 lines (127 loc) · 3.25 KB
/
Copy pathimmich.nix
File metadata and controls
146 lines (127 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{ config, lib, ... }:
let
inherit (lib) filterEmpty flatten;
immichOwned = {
owner = config.users.users.immich.name;
inherit (config.users.users.immich) group;
};
in
{
users = {
users.immich.uid = 998;
groups.immich.gid = 998;
};
sops.secrets = {
"IMMICH/ENV" = immichOwned;
};
server = {
database.postgres.immich = {
password = immichOwned;
};
dashboard.items.photos = {
title = "Immich";
icon = "sh-immich";
};
proxy.virtualHosts.photos = {
public = true;
extraConfig =
let
cfg = config.services.immich;
in
''
reverse_proxy http://${cfg.host}:${toString cfg.port}
'';
};
storage.swfsMount = {
immich = {
backend = "minio";
mountLocation = "/var/lib/immich";
inherit (config.users.users.immich) uid;
inherit (config.users.groups.immich) gid;
requiredByServices = [
"immich-server"
"immich-machine-learning"
];
};
};
};
services = {
immich = {
enable = true;
host = "0.0.0.0";
secretsFile = config.sops.secrets."IMMICH/ENV".path;
environment = {
IMMICH_TRUSTED_PROXIES =
config.server.network.subnets
|> map (subnet: [
subnet.ipv4.cidr
subnet.ipv6.cidr
])
|> flatten
|> filterEmpty
|> lib.concatStringsSep ",";
};
machine-learning.enable = true;
database =
let
db = config.server.database.postgres.immich;
in
{
inherit (db)
host
port
user
;
};
redis = {
enable = true;
};
settings = {
machineLearning = {
clip.modelName = "ViT-B-16-SigLIP__webli";
facialRecognition.modelName = "buffalo_l";
ocr.modelName = "PP-OCRv5_server";
};
oauth = {
enabled = true;
buttonText = "Sign in with Kanidm";
clientId = "immich";
clientSecret._secret = config.sops.secrets."KANIDM/OAUTH2/IMMICH_SECRET".path;
issuerUrl = "https://auth.racci.dev/oauth2/openid/immich";
signingAlgorithm = "ES256";
scope = "openid email profile";
tokenEndpointAuthMethod = "client_secret_post";
};
server = {
externalDomain = "https://photos.racci.dev";
publicUsers = true;
};
storageTemplate = {
enabled = true;
hashVerificationEnabled = true;
template = "{{#if album}}{{album-startDate-y}}/{{album}}{{else}}{{y}}/Other/{{MMM}}/{{dd}}/{{/if}}/{{hh}}_{{mm}}_{{ss}}-{{filename}}";
};
trash = {
enabled = true;
days = 30;
};
};
};
postgresql.enable = lib.mkForce false;
};
systemd.services = {
immich-server = {
requires = lib.mkForce [ "swfs-mount-nextcloud.service" ];
after = lib.mkForce [ "network.target" ];
};
immich-machine-learning = {
requires = lib.mkForce [ ];
after = lib.mkForce [ "network.target" ];
};
};
networking = {
firewall = {
allowedTCPPorts = [ config.services.immich.port ];
};
};
}