1
Fork 0
satellite/hosts/nixos/lapetus/services/grafana.nix

69 lines
1.6 KiB
Nix
Raw Normal View History

2024-02-24 06:52:01 +01:00
{ config, pkgs, ... }:
let secret = name: "$__file(${config.sops.secrets.${name}.path})";
in
{
imports = [
../../common/optional/services/nginx.nix
./prometheus.nix
];
sops.secrets.grafana_smtp_pass.sopsFile = ../secrets.yaml;
sops.secrets.grafana_discord_webhook.sopsFile = ../secrets.yaml;
# {{{ Main config
services.grafana = {
enable = true;
settings = {
2024-02-24 06:57:37 +01:00
server.domain = "grafana.moonythm.dev";
server.http_port = 8409;
2024-02-24 06:52:01 +01:00
# {{{ Smtp
smtp = {
enabled = true;
2024-02-24 07:36:54 +01:00
host = "smtp.migadu.com:456";
2024-02-24 06:52:01 +01:00
from_name = "Grafana";
password = secret "grafana_smtp_pass";
2024-02-24 07:43:54 +01:00
user = "grafana@orbit.moonythm.dev";
from_address = user;
2024-02-24 06:52:01 +01:00
};
# }}}
};
# {{{ Provisoning
provision = {
enable = true;
2024-02-24 07:36:54 +01:00
alerting.contactPoints.settings.contactPoints = [
{ name = "email"; }
2024-02-24 06:59:53 +01:00
{
name = "discord";
webhook_configs = [{
send_resolved = true;
url = secret "grafana_discord_webhook";
}];
2024-02-24 06:59:53 +01:00
}
];
2024-02-24 06:52:01 +01:00
2024-02-24 06:53:31 +01:00
datasources.settings.datasources = [{
2024-02-24 06:52:01 +01:00
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "prometheus.moonythm.dev";
2024-02-24 06:53:31 +01:00
}];
2024-02-24 06:52:01 +01:00
};
# }}}
};
# }}}
# {{{ Networking & storage
2024-02-24 06:57:37 +01:00
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} =
config.satellite.proxy config.services.grafana.settings.server.http_port { };
2024-02-24 06:52:01 +01:00
environment.persistence."/persist/state".directories = [{
directory = config.services.grafana.dataDir;
user = "grafana";
group = "grafana";
}];
2024-02-24 06:52:01 +01:00
# }}}
}