config/modules/services/grafana/default.nix

63 lines
1.4 KiB
Nix
Raw Normal View History

2024-08-03 03:03:55 +00:00
{
config,
lib,
myData,
...
}:
2024-08-03 02:57:15 +00:00
let
cfg = config.mj.services.grafana;
in
{
options.mj.services.grafana = with lib.types; {
enable = lib.mkEnableOption "enable grafana";
port = lib.mkOption { type = port; };
};
config = lib.mkIf cfg.enable {
services.grafana = {
enable = true;
provision = {
enable = true;
datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
isDefault = true;
jsonData.timeInterval = "10s";
}
];
};
};
settings = {
paths.logs = "/var/log/grafana";
2024-12-04 09:24:30 +00:00
smtp = {
enabled = true;
from_address = "noreply@jakstys.lt";
};
2024-08-03 02:57:15 +00:00
server = {
domain = "grafana.jakstys.lt";
2024-08-05 13:57:53 +00:00
root_url = "https://grafana.jakstys.lt";
2024-08-03 02:57:15 +00:00
enable_gzip = true;
http_addr = "0.0.0.0";
http_port = cfg.port;
};
users.auto_assign_org = true;
feature_toggles.accessTokenExpirationCheck = true;
};
};
2024-08-03 03:03:55 +00:00
mj.services.friendlyport.ports = [
{
subnets = [ myData.subnets.tailscale.cidr ];
tcp = [ cfg.port ];
}
];
2024-08-03 02:57:15 +00:00
};
}