From a45a08db57e76a1f03aa0d163e2ea952ae8f6ced Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Tue, 20 Dec 2022 21:44:22 +0100 Subject: [PATCH] Cleanup ildkule configs --- hosts/ildkule/services/metrics/grafana.nix | 8 +++++--- hosts/ildkule/services/metrics/loki.nix | 6 ++++-- hosts/ildkule/services/metrics/prometheus.nix | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) 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" ];