{ 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}.locations."/".proxyPort = cfg.port; }; }; users.users.${cfg.user}.uid = cfg.uid; users.groups.${cfg.user}.gid = cfg.gid; }; }