{ lib, config, ... }: let serviceDomain = "shots.swarsel.win"; servicePort = 3001; serviceUser = "immich"; serviceName = "immich"; in { options.swarselsystems.modules.server."${serviceName}" = lib.mkEnableOption "enable ${serviceName} on server"; config = lib.mkIf config.swarselsystems.modules.server."${serviceName}" { users.users."${serviceUser}" = { extraGroups = [ "video" "render" "users" ]; }; topology.self.services.immich.info = "https://${serviceDomain}"; services.immich = { enable = true; host = "0.0.0.0"; port = servicePort; openFirewall = true; mediaLocation = "/Vault/Eternor/Immich"; # dataDir environment = { IMMICH_MACHINE_LEARNING_URL = lib.mkForce "http://localhost:3003"; }; }; networking.firewall.allowedTCPPorts = [ 3001 ]; nodes.moonside.services.nginx = { upstreams = { "${serviceName}" = { servers = { "192.168.1.2:${builtins.toString servicePort}" = { }; }; }; }; virtualHosts = { "${serviceDomain}" = { enableACME = true; forceSSL = true; acmeRoot = null; locations = { "/" = { proxyPass = "http://${serviceName}"; extraConfig = '' client_max_body_size 0; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; proxy_read_timeout 600s; proxy_send_timeout 600s; send_timeout 600s; ''; }; }; }; }; }; }; }