Some fixups and further config

This commit is contained in:
xqtc161 2024-03-30 22:12:21 +01:00
parent 10d7e7a560
commit 88498233d3
2 changed files with 42 additions and 9 deletions

View file

@ -12,6 +12,8 @@
../../../common
inputs.nixos-hardware.nixosModules.common-cpu-intel
../../gc.nix
./monitoring.nix
];
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = ["nix-command" "flakes"];

View file

@ -1,15 +1,46 @@
{ config, pkgs, ... }: {
# grafana configuration
{
config,
pkgs,
...
}: {
networking.firewall.allowedTCPPorts = [80 443 9001];
services.grafana = {
enable = true;
# domain = "grafana";
settings.server = {
# domain = "grafana.seraphim.fritz.box";
port = 2342;
addr = "127.0.0.1";
};
};
# nginx reverse proxy
services.nginx.virtualHosts.${config.services.grafana.domain} = {
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd"];
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "seraphim";
static_configs = [
{
targets = ["127.0.0.1:${toString config.services.prometheus.exporters.node.port}"];
}
];
}
];
};
services.nginx.enable = true;
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
locations."/" = {
extraConfig = ''
proxy_set_header Host $host;
'';
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
};