commit f4950550fd2ed8dfe2e5d0d639091c71decdd6d6
parent 9151eec2551b38bd2c33c0d8cfd7972ab4fdfcb4
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 19 Jun 2025 19:18:55 +0200
parent 9151eec2551b38bd2c33c0d8cfd7972ab4fdfcb4
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 19 Jun 2025 19:18:55 +0200
config/nixos/modules/services/prometheusExporters: add `domain` option
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/config/nixos/modules/services/prometheusExporters.nix b/config/nixos/modules/services/prometheusExporters.nix @@ -16,6 +16,10 @@ in type = types.bool; default = false; }; + domain = { + type = types.str; + default = config.networking.fqdn; + }; }; config = lib.mkIf cfg.enable { @@ -38,7 +42,7 @@ in }; }; - nginx.virtualHosts."${config.networking.fqdn}".locations = { + nginx.virtualHosts."${cfg.domain}".locations = { "/node-exporter".proxyPass = "http://${toString config.services.prometheus.exporters.node.listenAddress}:${toString config.services.prometheus.exporters.node.port}/metrics"; "/systemd-exporter".proxyPass =
diff --git a/config/nixos/modules/websites/prometheus.infra.zaphyra.eu.nix b/config/nixos/modules/websites/prometheus.infra.zaphyra.eu.nix @@ -58,11 +58,7 @@ in targets = ( lib.mapAttrsToList ( name: host: - lib.mkIf ( - host.config.services.prometheus.exporters.node.enable == true - && host.config.networking.hostName != "" - && host.config.networking.domain != "" - ) host.config.networking.fqdn + lib.mkIf host.config.modules.services.prometheusExporters.enable host.config.modules.services.prometheusExporters.domain ) inputs.self.zaphyraHosts ); } @@ -78,11 +74,7 @@ in targets = ( lib.mapAttrsToList ( name: host: - lib.mkIf ( - host.config.services.prometheus.exporters.node.enable == true - && host.config.networking.hostName != "" - && host.config.networking.domain != "" - ) host.config.networking.fqdn + lib.mkIf host.config.modules.services.prometheusExporters.enable host.config.modules.services.prometheusExporters.domain ) inputs.self.zaphyraHosts ); }