mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-09-19 16:49:04 +05:30
feat: add uptime-kuma module
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
51
modules/nixos/services/uptime-kuma.nix
Normal file
51
modules/nixos/services/uptime-kuma.nix
Normal 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}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user