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
An option with the type either foo (submodule ...) (or oneOf [ (submodule ...) ... ]) will not have the suboptions of the submodule appear in the manual. This popped up in #191768 (comment).
The obvious fix would be to add something like getSubOptions = prefix: lib.attrsets.unionOfDisjoint (t1.getSubOptions prefix) (t2.getSubOptions prefix); to either, but this results in an infinite recursion because of recursively defined types like (pkgs.formats.yaml {}).type:
Generating the documentation for an option foo of that type will try to get the suboptions for foo, which will recurse to get the suboptions for foo.<name>, then foo.<name>.<name>, etc.
We could hack our way around this by overriding getSubOptions manually for recursive types, or setting a maximum recursion depth, but I can't really think of an elegant solution to this. Maybe we should just live with it, and document that submodule in either is not supported.
Perhaps recursive types should be defined through an explicit fixpoint? That way the fixpoint combinator can take care of plugging the infinite recursions for this, description and future such problems.
An option with the type
either foo (submodule ...)
(oroneOf [ (submodule ...) ... ]
) will not have the suboptions of the submodule appear in the manual. This popped up in #191768 (comment).The obvious fix would be to add something like
getSubOptions = prefix: lib.attrsets.unionOfDisjoint (t1.getSubOptions prefix) (t2.getSubOptions prefix);
toeither
, but this results in an infinite recursion because of recursively defined types like(pkgs.formats.yaml {}).type
:nixpkgs/pkgs/pkgs-lib/formats.nix
Lines 73 to 85 in 946eafd
Generating the documentation for an option
foo
of that type will try to get the suboptions forfoo
, which will recurse to get the suboptions forfoo.<name>
, thenfoo.<name>.<name>
, etc.We could hack our way around this by overriding
getSubOptions
manually for recursive types, or setting a maximum recursion depth, but I can't really think of an elegant solution to this. Maybe we should just live with it, and document thatsubmodule
ineither
is not supported.cc @infinisil @roberth
The text was updated successfully, but these errors were encountered: