From a3a8c1f54d87cd9645eadb7dce441c7a29ccaa0f Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 11 Feb 2018 22:04:09 +0000 Subject: [PATCH 1/3] lib: export option location in `optionAttrSetToDocList` --- lib/options.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/options.nix b/lib/options.nix index e10c86dd506..9446eca3677 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -85,6 +85,7 @@ rec { concatMap (opt: let docOption = rec { + loc = opt.loc; name = showOption opt.loc; description = opt.description or (throw "Option `${name}' has no description."); declarations = filter (x: x != unknownModule) opt.declarations; From 252ec7da0a1d624db46b299052122b4a5dbf3254 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 11 Feb 2018 22:06:50 +0000 Subject: [PATCH 2/3] nixos: doc: make option sorting somewhat more efficient --- nixos/doc/manual/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 66fa4f0ba43..e7d6c822e51 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -66,15 +66,14 @@ let # and ".package" optionListLess = a: b: let - splt = lib.splitString "."; ise = lib.hasPrefix "enable"; isp = lib.hasPrefix "package"; cmp = lib.splitByAndCompare ise lib.compare (lib.splitByAndCompare isp lib.compare lib.compare); - in lib.compareLists cmp (splt a) (splt b) < 0; + in lib.compareLists cmp a.loc b.loc < 0; # Customly sort option list for the man page. - optionsList = lib.sort (a: b: optionListLess a.name b.name) optionsListDesc; + optionsList = lib.sort optionListLess optionsListDesc; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList); From b468f98b02275a2ef37422576cbfcc896097980c Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 11 Feb 2018 22:41:06 +0000 Subject: [PATCH 3/3] nixos: doc: trivial cleanup and docstring fix --- nixos/doc/manual/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index e7d6c822e51..bbe82066aa0 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -63,8 +63,8 @@ let stripAnyPrefixes = lib.flip (lib.fold lib.removePrefix) prefixesToStrip; # Custom "less" that pushes up all the things ending in ".enable*" - # and ".package" - optionListLess = a: b: + # and ".package*" + optionLess = a: b: let ise = lib.hasPrefix "enable"; isp = lib.hasPrefix "package"; @@ -73,7 +73,7 @@ let in lib.compareLists cmp a.loc b.loc < 0; # Customly sort option list for the man page. - optionsList = lib.sort optionListLess optionsListDesc; + optionsList = lib.sort optionLess optionsListDesc; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList);