nixos/spec/focus/grafana.nix

37 lines
920 B
Nix

{ config
, ... }: {
services.grafana = {
enable = true;
dataDir = "/nix/persist/service/grafana";
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3000;
domain = "sf.514fpv.io";
root_url = "https://sf.514fpv.io:8086/dash";
serve_from_sub_path = true;
};
};
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
};
};
services.nginx.virtualHosts."sf.514fpv.io".locations."/dash/" = {
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
recommendedProxySettings = true;
};
global.fs.zfs.mountpoints."/nix/persist/service/grafana" = "service/grafana";
}