···
# Remove invisible and internal options.
9
-
optionsList = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options);
9
+
optionsListVisible = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options);
# Replace functions by the string <function>
···
# Clean up declaration sites to not refer to the NixOS source tree.
19
-
optionsList' = lib.flip map optionsList (opt: opt // {
19
+
optionsListDesc = lib.flip map optionsListVisible (opt: opt // {
declarations = map stripAnyPrefixes opt.declarations;
// lib.optionalAttrs (opt ? example) { example = substFunction opt.example; }
···
prefixesToStrip = map (p: "${toString p}/") ([ ../../.. ] ++ extraSources);
stripAnyPrefixes = lib.flip (lib.fold lib.removePrefix) prefixesToStrip;
35
+
# Custom "less" that pushes up all the things ending in ".enable*"
37
+
optionListLess = a: b:
39
+
splt = lib.splitString ".";
40
+
ise = lib.hasPrefix "enable";
41
+
isp = lib.hasPrefix "package";
42
+
cmp = lib.splitByAndCompare ise lib.compare
43
+
(lib.splitByAndCompare isp lib.compare lib.compare);
44
+
in lib.compareLists cmp (splt a) (splt b) < 0;
46
+
# Customly sort option list for the man page.
47
+
optionsList = lib.sort (a: b: optionListLess a.name b.name) optionsListDesc;
# Convert the list of options into an XML file.
36
-
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList');
50
+
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList);
optionsDocBook = runCommand "options-db.xml" {} ''
···
cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON
194
-
(builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList'))))
208
+
(builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList))))
mkdir -p $out/nix-support