0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

lib/modules: Introduce _module.checks.*.check

Previously the .enable option was used to encode the condition as well,
which lead to some oddness:
- In order to encode an assertion, one had to invert it
- To disable a check, one had to mkForce it

By introducing a separate .check option this is solved because:
- It can be used to encode assertions
- Disabling is done separately with .enable option, whose default can be
  overridden without a mkForce
This commit is contained in:
Silvan Mosberger 2020-11-30 22:38:56 +01:00
parent 991dfccbd1
commit 767d80099c
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D
13 changed files with 56 additions and 48 deletions

View file

@ -36,7 +36,7 @@ with lib;
name = "_${toString n}";
isWarning = lib.isString value;
result = {
enable = if isWarning then true else ! value.assertion;
check = if isWarning then false else value.assertion;
type = if isWarning then "warning" else "error";
message = if isWarning then value else value.message;
};