puter/classes/headless/grafana.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2025-03-01 21:21:00 +00:00
{
2025-03-09 15:37:21 +00:00
config,
lib,
...
}: {
2025-03-01 21:21:00 +00:00
services.grafana = {
enable = true;
2025-03-09 15:37:21 +00:00
settings.server = {
domain = "grafana.pele";
http_port = 9010;
http_addr = "127.0.0.1";
root_url = "http://192.168.1.10:8010"; # TODO
protocol = "http";
};
2025-03-01 21:21:00 +00:00
analytics.reporting.enable = false;
provision = {
enable = true;
2025-03-09 15:37:21 +00:00
datasources.settings.datasources = [
2025-03-01 21:21:00 +00:00
{
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}";
}
];
};
};
2025-03-09 15:37:21 +00:00
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
2025-03-01 21:21:00 +00:00
locations."/" = {
proxyPass = "http://${lib.formatHostPort {
2025-03-09 15:37:21 +00:00
host = config.services.grafana.settings.server.http_addr;
port = config.services.grafana.settings.server.http_port;
2025-03-01 21:21:00 +00:00
}}";
proxyWebsockets = true;
};
};
}