diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2018-02-12 08:31:43 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2018-02-12 08:31:43 +0100 |
commit | 040bde90521c9956e8970b35305a337732cf0ade (patch) | |
tree | 6f4935a97c2d02c748f7bca9e76bfd752755d21a /nixos/doc/manual | |
parent | 53e790e7a861e498b3136fc9da7f53ec1642443a (diff) | |
parent | b468f98b02275a2ef37422576cbfcc896097980c (diff) |
Merge #34866: nixos doc: efficient comparisons
This solves most of the performance regression from a7d75ab (#33898).
Diffstat (limited to 'nixos/doc/manual')
-rw-r--r-- | nixos/doc/manual/default.nix | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 66fa4f0ba43cb..bbe82066aa0c1 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -63,18 +63,17 @@ 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 - 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 optionLess optionsListDesc; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList); |