feat: add uptime-kuma module

This commit is contained in:
tux
2026-08-08 15:34:44 +05:30
parent 162b822870
commit 819c54d46f
2 changed files with 57 additions and 0 deletions

View File

@@ -44,6 +44,12 @@
domain = "lab.tux.rs"; domain = "lab.tux.rs";
}; };
uptime-kuma = {
enable = true;
port = 1111;
domain = "status.lab.tux.rs";
};
mediaflow-proxy = { mediaflow-proxy = {
enable = true; enable = true;
port = 8888; port = 8888;

View File

@@ -0,0 +1,51 @@
{
flake.modules.nixos.services =
{
config,
lib,
...
}:
with lib;
let
cfg = config.tnix.services.uptime-kuma;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
options.tnix.services.uptime-kuma = {
enable = mkEnableOption "Uptime Kuma";
port = mkOption {
type = types.port;
default = 1111;
description = "Port on which Uptime Kuma listens";
};
domain = mkOption {
type = types.str;
default = "";
description = "Domain on which nginx serves Uptime Kuma (disabled when empty)";
};
};
config = mkIf cfg.enable {
services = {
uptime-kuma = {
enable = true;
settings = {
HOST = "127.0.0.1";
PORT = port;
};
};
nginx.virtualHosts.${cfg.domain} = mkIf (cfg.domain != "") {
forceSSL = acmeHost != "";
useACMEHost = mkIf (acmeHost != "") acmeHost;
locations."/" = {
proxyPass = "http://127.0.0.1:${port}";
};
};
};
};
};
}