aboutsummaryrefslogtreecommitdiffstats
path: root/apps/grafana/module.nix
blob: 8f2a36545e0fcc2847fa11a70f6a550698593c0d (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
{ appConfig, lib, ... }: lib.mkMerge [
  {
    services.grafana.enable = true;
    services.grafana.settings.security.disable_initial_admin_creation = true;
    services.grafana.settings.server.domain = appConfig.domain;
    services.grafana.settings.server.http_addr = "[::0]";
  }
  {
    services.prometheus.enable = true;
    services.prometheus.exporters.systemd.enable = true;
    services.prometheus.scrapeConfigs = [
      {
        job_name = "systemd";
        static_configs = [{ targets = [ "[::1]:9558" ]; }];
      }
    ];
  }
  {
    services.grafana.settings."auth.proxy".auto_sign_up = true;
    services.grafana.settings."auth.proxy".enabled = true;
    services.grafana.settings."auth.proxy".header_name = "Remote-User";
    services.grafana.settings."auth.proxy".headers = lib.concatStringsSep " " [ "Email:Remote-Email" "Name:Remote-Name" "Role:Remote-Role" ];

    services.grafana.settings."users".allow_sign_up = false;
  }
  {
    services.grafana.provision.datasources.settings.datasources = [
      {
        name = "Prometheus";
        type = "prometheus";
        url = "http://[23::1]:9090";
      }
    ];
  }
]