53 lines
1.2 KiB
Nix
53 lines
1.2 KiB
Nix
{ lib, config, ... }:
|
|
let
|
|
cfg = config.services.immich;
|
|
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
|
in
|
|
{
|
|
options.services.immich = {
|
|
subdomain = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
timezone = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "UTC";
|
|
};
|
|
uid = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 990;
|
|
};
|
|
gid = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 997;
|
|
};
|
|
};
|
|
config = lib.mkIf cfg.enable {
|
|
services = {
|
|
immich = {
|
|
environment = {
|
|
TZ = cfg.timezone;
|
|
};
|
|
settings.server.externalDomain = "https://${fqdn}";
|
|
};
|
|
webserver = {
|
|
enable = lib.mkDefault true;
|
|
vHosts.${fqdn} = {
|
|
proxyBuffering = false;
|
|
locations."/" = {
|
|
proxyPort = cfg.port;
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
proxy_send_timeout 300;
|
|
proxy_read_timeout 300;
|
|
send_timeout 300;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
users.users.${cfg.user}.uid = cfg.uid;
|
|
users.groups.${cfg.user}.gid = cfg.gid;
|
|
};
|
|
}
|