You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib/options: Don't show internal suboption in the manual
Initially NixOS#82897 prevented
non-visible options from being rendered in the manual, but
visible-but-internal options were still being recursed into. This fixes
this, aligning the recurse condition here with the one in
make-options-doc/default.nix
lib/modules: Implement module-builtin assertions
This implements assertions/warnings supported by the module system directly,
instead of just being a NixOS option (see
nixos/modules/misc/assertions.nix).
This has the following benefits:
- It allows cleanly redoing the user interface. The new
implementation specifically allows disabling assertions or
converting them to warnings instead.
- Assertions/warnings can now be thrown easily from within
submodules, which previously wasn't possible and needed workarounds.
nixos/assertions: Use module-builtin assertion implementation
lib/modules: Use module-builtin assertions for mkRemovedOptionModule and co.
nixos/modules: Allow options to be coerced to a string for convenience
nixos/modules: Expose the internal module in the top-level documentation
nixos/docs: Update assertion docs for new module-builtin ones
lib/tests: Implement generalized checkConfigCodeOutErr for module tests
lib/tests: Add tests for module-builtin assertions
lib/modules: Rename _module.assertions to _module.checks
lib/modules: Remove _module.checks.*.triggerPath as it's not necessary
Previously this option was thought to be necessary to avoid infinite
recursion, but it actually isn't, since the check evaluation isn't fed
back into the module fixed-point.
lib/modules: _module.check should always be internal
Honestly this option should probably just be removed
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
lib/modules: Prefix mkRemovedOptionModule & co. check names
To avoid name clashes
Co-authored-by: Robert Hensing <robert@roberthensing.nl>
bla
The option definition `${showOptionoptionName}' in ${showFilesopt.files} no longer has any effect; please remove it.
882
992
${replacementInstructions}
883
993
'';
884
-
}];
994
+
};
995
+
};
885
996
};
886
997
887
998
/* Return a module that causes a warning to be shown if the
@@ -942,14 +1053,18 @@ rec {
942
1053
}))from);
943
1054
944
1055
config={
945
-
warnings=filter(x: x!="")(map(f:
946
-
letval=getAttrFromPathfconfig;
947
-
opt=getAttrFromPathfoptions;
948
-
in
949
-
optionalString
950
-
(val!="_mkMergedOptionModule")
951
-
"The option `${showOptionf}' defined in ${showFilesopt.files} has been changed to `${showOptionto}' that has a different type. Please read `${showOptionto}' documentation and update your configuration accordingly."
message="The option `${showOptionf}' defined in ${showFilesopt.files} has been changed to `${showOptionto}' that has a different type. Please read `${showOptionto}' documentation and update your configuration accordingly.";
# Test that types.optionType correctly annotates option locations
312
331
checkConfigError 'The option .theOption.nested. in .other.nix. is already declared in .optionTypeFile.nix.' config.theOption.nested ./optionTypeFile.nix
313
332
333
+
## Module assertions
334
+
# Check that assertions are triggered by default for just evaluating config
0 commit comments