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

65 lines
1.4 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 = {
domain = "grafana.moonythm.dev";
port = 8409;
addr = "127.0.0.1";
# {{{ Smtp
smtp = {
enabled = true;
host = "smtp.migadu.com";
port = 465;
from_name = "Grafana";
from_address = "grafana@orbit.moonythm.dev";
password = secret "grafana_smtp_pass";
};
# }}}
};
# {{{ Provisoning
provision = {
enable = true;
notifiers = {
email.type = "email";
discord = {
type = "discord";
settings.webhook_url = secret "grafana_discord_webhook";
};
};
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
services.nginx.virtualHosts.${config.services.grafana.domain} =
config.satellite.proxy config.services.grafana.port { };
environment.persistence."/persist/state".directories = [
config.services.grafana.dataDir
];
# }}}
}