blob: 95da536cf6e69f8563b61d6241f4f599d2407c49 (
plain)
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
|
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.modules.services.immich;
in
{
options.modules.services.immich = {
enable = mkEnableOption "immich";
port = mkOption {
default = 2283;
type = types.int;
};
url = mkOption {
default = null;
type = types.str;
};
mediaDir = mkOption {
default = "/var/lib/immich";
type = types.str;
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = mkIf (cfg.url != null) [
80
443
];
services.caddy = mkIf (cfg.url != null) {
enable = true;
virtualHosts = {
"photographs.brownbread.net".extraConfig = ''
encode zstd gzip
reverse_proxy http://localhost:${builtins.toString cfg.port}
'';
};
};
services.immich = {
enable = true;
package = pkgs.immich;
host = "localhost";
port = cfg.port;
mediaLocation = cfg.mediaDir;
environment = {
IMMICH_LOG_LEVEL = "log";
};
};
};
}
|