diff options
author | pennae <github@quasiparticle.net> | 2021-10-18 00:42:33 +0200 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2021-10-18 03:45:33 +0200 |
commit | 24eb35390785e8ef8dc7adf26b6974766ae6562f (patch) | |
tree | ae6a8bb6cd66ca3e17dbb7dfac345d9e9d6b27f8 /nixos/lib/make-options-doc/default.nix | |
parent | 97774c04878aa222e91c310aea21b6c3c8313062 (diff) |
make-options-docs: don't sort the options XML file
we need the file itself as a dependency for the docbook build, but we don't need it to be properly sorted at the nix level. push the sort out to a python script instead to save eval time. on the machine used to write this `nix-instantiate <nixos/nixos> -A system` went down from 7.1s to 5.4s and GC heap size decreased by 50MB (or 70MB max RSS).
Diffstat (limited to 'nixos/lib/make-options-doc/default.nix')
-rw-r--r-- | nixos/lib/make-options-doc/default.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix index 14015ab64abb7..e058e70f3888e 100644 --- a/nixos/lib/make-options-doc/default.nix +++ b/nixos/lib/make-options-doc/default.nix @@ -83,10 +83,13 @@ let optionsListVisible = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options); # Customly sort option list for the man page. + # Always ensure that the sort order matches sortXML.py! optionsList = lib.sort optionLess optionsListDesc; # Convert the list of options into an XML file. - optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList); + # This file is *not* sorted sorted to save on eval time, since the docbook XML + # and the manpage depend on it and thus we evaluate this on every system rebuild. + optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsListDesc); optionsNix = builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList); @@ -185,9 +188,10 @@ in { exit 1 fi + ${pkgs.python3Minimal}/bin/python ${./sortXML.py} $optionsXML sorted.xml ${pkgs.libxslt.bin}/bin/xsltproc \ --stringparam revision '${revision}' \ - -o intermediate.xml ${./options-to-docbook.xsl} $optionsXML + -o intermediate.xml ${./options-to-docbook.xsl} sorted.xml ${pkgs.libxslt.bin}/bin/xsltproc \ -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml ''; |