Merge pull request #97023 from Infinisil/module-assertions
Module-builtin assertions, disabling assertions and submodule assertions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ lib, ... }:
|
||||
{ lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -30,5 +30,18 @@ with lib;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config._module.checks = lib.listToAttrs (lib.imap1 (n: value:
|
||||
let
|
||||
name = "_${toString n}";
|
||||
isWarning = lib.isString value;
|
||||
result = {
|
||||
check = if isWarning then false else value.assertion;
|
||||
type = if isWarning then "warning" else "error";
|
||||
message = if isWarning then value else value.message;
|
||||
};
|
||||
in nameValuePair name result
|
||||
) (config.assertions ++ config.warnings));
|
||||
|
||||
# impl of assertions is in <nixpkgs/nixos/modules/system/activation/top-level.nix>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user