{ config, pkgs, lib, mkDomain, ... }:
{
  # Graphana
  # Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB

  services.grafana = rec {
    #enable = true;
    #addr = "127.0.0.1";
    settings.server.http_addr = "0.0.0.0";
    settings.server.http_port = 3000;
    settings.server.domain = mkDomain "grafana";
    #rootUrl = "https://${domain}/grafana/"; # Not needed if it is `https://your.domain/`
  };
  services.nginx.virtualHosts."${config.services.grafana.settings.server.domain}" = lib.mkIf config.services.grafana.enable {
    forceSSL = true; # addSSL = true;
    enableACME = true; #useACMEHost = acmeDomain;
    #locations."/grafana/" = {
    locations."/" = {
      proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
      proxyWebsockets = true;
    };
  };

}
