dotfiles/modules/nixos/services/grafana.nix

29 lines
616 B
Nix
Raw Normal View History

{ config, lib, ... }: {
options.metricsServer = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Hostname of the metrics server.";
default = null;
};
config = lib.mkIf config.services.grafana.enable {
2023-07-04 23:15:04 +00:00
services.grafana.settings.server = {
domain = config.metricsServer;
2023-07-04 23:05:56 +00:00
http_addr = "127.0.0.1";
http_port = 3000;
2023-07-04 23:15:04 +00:00
protocol = "http";
2023-07-04 23:05:56 +00:00
};
caddy.routes = [{
match = [{ host = [ config.metricsServer ]; }];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:3000"; }];
}];
}];
};
}