summaryrefslogtreecommitdiff
path: root/os/srv/uptime-kuma.nix
blob: 7bf8dd01e09a14487414b172924524509efe5415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  config,
  lib,
  masterDomain,
  securityTemplates,
  ...
}:
let
  cfg = config.os.srv.uptime-kuma;
in
{
  options.os.srv.uptime-kuma = {
    enable = lib.mkEnableOption "enables uptime-kuma";
    proxyConfig = lib.mkOption {
      type = lib.types.attrs;
      default = { };
    };
  };
  config = lib.mkIf cfg.enable {
    services.uptime-kuma = {
      enable = true;
      appriseSupport = true;
      settings = {
        HOST = "127.0.0.1";
        UPTIME_KUMA_DB_TYPE = "sqlite";
      };
    };

    os.srv.uptime-kuma.proxyConfig = {
      "uptime-kuma.${masterDomain}" = {
        enableACME = true;
        forceSSL = true;

        locations."/" = {
          proxyPass = "http://${config.os.core.network.ips.vm2-gateway}:3001";
          extraConfig = securityTemplates.restrictToInternal;
        };
      };
    };
  };
}