From 22b61e52634160847a19e63b65265219f9a806d6 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 13 Mar 2021 15:21:19 +0100 Subject: [PATCH] nixos/prometheus/exporters: fix eval if only `openFirewall = true;` is set If `openFirewall = true`, but no `firewallFilter` is set, the evaluation fails with the following error: The option `services.prometheus.exporters.node.firewallFilter` is defined both null and not null, in `/home/ma27/Projects/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix' and `/home/ma27/Projects/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix'. Originally introduced by me in #115185. The problem is that `mkOptionDefault` has - as its name suggests - the same priority as the default-value of the option `firewallFilter` and thus it conflicts if this declaration and the actual default value are set which is the case if `firewallFilter` isn't specified somewhere else. --- nixos/modules/services/monitoring/prometheus/exporters.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 74ad4bf1837..5811cda1125 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -131,7 +131,7 @@ let inherit name port; } // extraOpts); } ({ config, ... }: mkIf config.openFirewall { - firewallFilter = mkOptionDefault "-p tcp -m tcp --dport ${toString config.port}"; + firewallFilter = mkDefault "-p tcp -m tcp --dport ${toString config.port}"; })]; internal = true; default = {};