haios/modules/nixos/services/hosted/uptime-kuma.nix
2025-02-18 22:19:38 +02:00

32 lines
679 B
Nix

{
lib,
haiLib,
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (haiLib) mkServiceOption;
rdomain = config.networking.domain;
cfg = config.olympus.services.uptime-kuma;
in {
options.olympus.services.uptime-kuma = mkServiceOption "uptime-kuma" {
port = 3001;
domain = "kuma.${rdomain}";
};
config = mkIf cfg.enable {
services.uptime-kuma = {
enable = true;
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
settings.PORT = toString cfg.port;
};
services.caddy.virtualHosts.${cfg.domain} = {
extraConfig = ''
reverse_proxy localhost:${toString cfg.port}
'';
};
};
}