{ lib, config, ... }: { options.services.immich = { domain = lib.mkOption { type = lib.types.str; description = "domain that immich will be hosted at"; default = "immich.arpa"; }; extraDomains = lib.mkOption { type = lib.types.listOf lib.types.str; description = "extra domains that should be configured for immich"; default = []; }; reverseProxy = { enable = lib.mkOption { type = lib.types.bool; default = config.services.immich.enable && config.services.reverseProxy.enable; }; }; }; config = lib.mkIf config.services.immich.reverseProxy.enable { services.reverseProxy.services.immich = { target = "http://localhost:${toString config.services.immich.port}"; domain = config.services.immich.domain; extraDomains = config.services.immich.extraDomains; settings = { proxyWebsockets.enable = true; forwardHeaders.enable = true; maxBodySize = 50000; # Custom timeout settings proxyHeaders = { enable = true; timeout = 600; }; }; }; }; }