diff --git a/hosts/ildkule/services/metrics/grafana.nix b/hosts/ildkule/services/metrics/grafana.nix index fecb89a..f096b5c 100644 --- a/hosts/ildkule/services/metrics/grafana.nix +++ b/hosts/ildkule/services/metrics/grafana.nix @@ -1,6 +1,8 @@ { config, pkgs, ... }: -{ +let + cfg = config.services.grafana; +in { services.grafana = { enable = true; settings.server = { @@ -35,12 +37,12 @@ }; }; - services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = { + services.nginx.virtualHosts.${cfg.settings.server.domain} = { enableACME = true; forceSSL = true; locations = { "/" = { - proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}"; + proxyPass = "http://127.0.0.1:${toString cfg.settings.server.http_port}"; proxyWebsockets = true; extraConfig = '' proxy_buffers 8 1024k; diff --git a/hosts/ildkule/services/metrics/loki.nix b/hosts/ildkule/services/metrics/loki.nix index 697c0fe..bb644a6 100644 --- a/hosts/ildkule/services/metrics/loki.nix +++ b/hosts/ildkule/services/metrics/loki.nix @@ -1,6 +1,8 @@ { config, pkgs, ... }: -{ +let + cfg = config.services.loki; +in { services.loki = { enable = true; configuration = { @@ -80,5 +82,5 @@ }; }; - networking.firewall.allowedTCPPorts = [ config.services.loki.configuration.server.http_listen_port ]; + networking.firewall.allowedTCPPorts = [ cfg.configuration.server.http_listen_port ]; } diff --git a/hosts/ildkule/services/metrics/prometheus.nix b/hosts/ildkule/services/metrics/prometheus.nix index 3ea124a..0bfe0f8 100644 --- a/hosts/ildkule/services/metrics/prometheus.nix +++ b/hosts/ildkule/services/metrics/prometheus.nix @@ -1,6 +1,8 @@ { config, pkgs, ... }: -{ +let + cfg = config.services.prometheus; +in { services.prometheus = { enable = true; listenAddress = "127.0.0.1"; @@ -12,7 +14,7 @@ static_configs = [ { targets = [ - "ildkule.pvv.ntnu.no:${toString config.services.prometheus.exporters.node.port}" + "ildkule.pvv.ntnu.no:${toString cfg.exporters.node.port}" "microbel.pvv.ntnu.no:9100" "knakelibrak.pvv.ntnu.no:9100" ];