summaryrefslogtreecommitdiff
path: root/os/srv/netdata.nix
blob: 87854d490e1176d79d62ec7ea4dabb2a68b65376 (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
{
  config,
  lib,
  masterDomain,
  securityTemplates,
  ...
}:
let
  cfg = config.os.srv.netdata;
in
{
  options.os.srv.netdata.enable = lib.mkEnableOption "enables netdata monitoring";
  config = lib.mkIf cfg.enable {
    services.netdata = {
      enable = true;
      config.web."bind to" = "127.0.0.1";

      python = {
        enable = true;
        recommendedPythonPackages = true;
      };
    };

    services.nginx.virtualHosts."netdata.${masterDomain}" = {
      enableACME = true;
      forceSSL = true;

      locations."/" = {
        proxyPass = "http://127.0.0.1:19999";
        extraConfig = securityTemplates.restrictToInternal;
      };
    };
  };
}