3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #174470 from hercules-ci/module-docs-visibility-override

make-options-doc: Allow transformOptions to override visibility
This commit is contained in:
Robert Hensing 2022-06-10 14:27:58 +02:00 committed by GitHub
commit 9970c0b874
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,8 +47,11 @@ let
else if lib.isFunction x then "<function>"
else x;
optionsList = lib.flip map optionsListVisible
(opt: transformOptions opt
rawOpts = lib.optionAttrSetToDocList options;
transformedOpts = map transformOptions rawOpts;
filteredOpts = lib.filter (opt: opt.visible && !opt.internal) transformedOpts;
optionsList = lib.flip map filteredOpts
(opt: opt
// lib.optionalAttrs (opt ? example) { example = substSpecial opt.example; }
// lib.optionalAttrs (opt ? default) { default = substSpecial opt.default; }
// lib.optionalAttrs (opt ? type) { type = substSpecial opt.type; }
@ -90,9 +93,6 @@ let
'';
in "<itemizedlist>${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}</itemizedlist>";
# Remove invisible and internal options.
optionsListVisible = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options);
optionsNix = builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList);
in rec {