{ config, lib, pkgs, options, ... }: with lib; let cfg = config.modules.services.uptime; in { options.modules.services.uptime = { enable = mkEnableOption "enable uptime kuma, a self-hosted uptime website"; port = mkOption { type = types.int; default = 3002; }; domain = mkOption { type = types.str; default = "status.reidlab.pink"; }; }; config = mkIf cfg.enable { services.uptime-kuma = { enable = true; settings.PORT = toString cfg.port; }; services.nginx.virtualHosts."${cfg.domain}" = { forceSSL = true; enableACME = true; locations."/" = { proxyPass = "http://127.0.0.1:${toString cfg.port}"; }; }; }; }