diff options
author | Martin Milata <martin@martinmilata.cz> | 2020-03-06 01:41:40 +0100 |
---|---|---|
committer | Martin Milata <martin@martinmilata.cz> | 2020-03-06 01:44:05 +0100 |
commit | 3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8 (patch) | |
tree | df8fee86f3f1fc2065de006e24506f0669f45082 | |
parent | 2a080ac4349899a9d1d103ba42b0c8ecba95dba0 (diff) | |
download | nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar.gz nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar.bz2 nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar.lz nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar.xz nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.tar.zst nixpkgs-3b5cf35e8bc5198cbd9f2e34a6df9c971947a7e8.zip |
nixos/prometheus-mail-exporter: fix assertion
The assertion was printed when user explicitly defined only the configFile option.
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/mail.nix | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index e9845fc4bb8..aeed55172da 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -205,7 +205,9 @@ in or `services.prometheus.exporters.snmp.configurationPath' set! ''; } { - assertion = (cfg.mail.configFile == null) != (cfg.mail.configuration == {}); + assertion = cfg.mail.enable -> ( + (cfg.mail.configFile == null) != (cfg.mail.configuration == null) + ); message = '' Please specify either 'services.prometheus.exporters.mail.configuration' or 'services.prometheus.exporters.mail.configFile'. diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix index 7754e8fb8a6..4d9239f7bb3 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix @@ -127,8 +127,8 @@ in ''; }; configuration = mkOption { - type = types.submodule exporterOptions; - default = {}; + type = types.nullOr (types.submodule exporterOptions); + default = null; description = '' Specify the mailexporter configuration file to use. ''; @@ -148,7 +148,7 @@ in ${pkgs.prometheus-mail-exporter}/bin/mailexporter \ --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ --config.file ${ - if cfg.configuration != {} then configurationFile else (escapeShellArg cfg.configFile) + if cfg.configuration != null then configurationFile else (escapeShellArg cfg.configFile) } \ ${concatStringsSep " \\\n " cfg.extraFlags} ''; |