diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix index 488d0fa..3f5ffd8 100644 --- a/modules/services/grafana/default.nix +++ b/modules/services/grafana/default.nix @@ -28,6 +28,28 @@ in { http_port = 2342; http_addr = "0.0.0.0"; }; + + provision = { + enable = true; + datasources = { + # This assumes prometheus, loki, and grafana are all running on the + # same host. + settings.datasources = [ + { + name = "Prometheus"; + type = "prometheus"; + access = "proxy"; + url = "http://127.0.0.1:${toString config.services.prometheus.port}"; + } + { + name = "Loki"; + type = "loki"; + access = "proxy"; + url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}"; + } + ]; + }; + }; }; services.nginx = {