nix-config/hosts/nixedo/services/uptime-kuma.nix

35 lines
736 B
Nix

{ config, lib, ... }:
with lib;
let
cfg = homelab.services.${service};
homelab = config.features.homelab;
service = "uptime-kuma";
in
{
options.features.homelab.services.${service} = {
enable = mkEnableOption "Enable ${service}";
url = mkOption {
default = "uptime.${homelab.baseDomain}";
type = types.str;
};
};
config = mkIf cfg.enable {
services = {
${service}.enable = true;
nginx.virtualHosts.${cfg.url} = {
forceSSL = true;
useACMEHost = homelab.baseDomain;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.${service}.settings.PORT}";
recommendedProxySettings = true;
};
};
};
};
}