From 98d6439f2ad1a0da34e0251bed29f093232419a9 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 27 Jun 2024 06:17:53 +0000 Subject: [PATCH] modules/warnings: add a way to bypass module-level assertions as well --- modules/warnings.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/warnings.nix b/modules/warnings.nix index 6f2e0a38a..4116f560f 100644 --- a/modules/warnings.nix +++ b/modules/warnings.nix @@ -8,8 +8,20 @@ list of `config.warnings` values you want to ignore, verbatim. ''; }; + sane.silencedAssertions = mkOption { + type = types.listOf types.str; + default = []; + description = '' + list of `config.assertions` values you want to ignore, keyed by `message`, interpreted as a regex. + ''; + }; warnings = mkOption { apply = builtins.filter (w: !(builtins.elem w config.sane.silencedWarnings)); }; + assertions = mkOption { + # N.B.: don't evaluation `.message` before checking `.assertion`. + # valid assertions are (defacto) allowed to have non-evaluatable messages. + apply = builtins.filter (a: !(builtins.any (s: !a.assertion && builtins.match s a.message != null) config.sane.silencedAssertions)); + }; }; }