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:
parent
991dfccbd1
commit
767d80099c
13 changed files with 56 additions and 48 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue