1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

lib.types.submodule: Disable check during docs generation

Put simply docs generation is a weird eval, and we should avoid
generating any unnecessary errors.
This commit is contained in:
Robert Hensing 2025-04-07 21:50:57 +02:00
parent 859328f27e
commit e09cf9f066
2 changed files with 65 additions and 2 deletions

View file

@ -2830,6 +2830,42 @@ runTests {
expected = "unknown";
};
# https://github.com/NixOS/nixpkgs/issues/396849
"test: submodule definitions aren't unchecked when evaluating submodule documentation" = {
expr =
let
module =
{ lib, ... }:
{
options.foo = lib.mkOption { type = lib.types.submodule submodule; };
};
submodule = {
options.bar = lib.mkOption { type = lib.types.int; };
config.submoduleWrong = throw "yikes";
};
options = (evalModules { modules = [ module ]; }).options;
renderableOpts = filter (o: !o.internal) (optionAttrSetToDocList options);
# Evaluate the whole docs
in
builtins.deepSeq renderableOpts
# Return the locations
(map (o: o.loc) renderableOpts);
expected = [
[
"_module"
"args"
]
[ "foo" ]
[
"foo"
"bar"
]
];
};
testFreeformOptions = {
expr =
let