NixOS-Config/nixos/server/package-configs/dashboard/grafana/default.nix

49 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-03-26 14:13:35 +01:00
{
config,
pkgs,
...
}: {
# grafana configuration
services.grafana = {
enable = true;
settings.server = {
domain = "grafana.lillianviolet.dev";
http_port = 2342;
http_addr = "127.0.0.1";
};
provision = {
datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "http://localhost:${toString config.services.prometheus.port}";
isDefault = true;
}
# {
# name = "Loki";
# type = "loki";
# access = "proxy";
# url = "http://localhost:${config.services.loki.port}";
# isDefault = true;
# }
];
};
};
2024-03-26 14:13:35 +01:00
};
# nginx reverse proxy
2024-03-26 14:40:05 +01:00
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
2024-03-26 14:13:35 +01:00
## Force HTTP redirect to HTTPS
forceSSL = true;
## LetsEncrypt
enableACME = true;
locations."/" = {
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
2024-03-26 14:13:35 +01:00
proxyWebsockets = true;
};
};
}