* In the generation of the `options.xml' file used to produce the
NixOS manual and manpages, remove all derivation attributes except the `name' attribute. This cuts the size of `options.xml' from 7.0 MiB to 473 KiB, and more importantly, cuts evaluation time of the system derivation from 1.63s to 1.10s on my laptop (a 32% improvement). svn path=/nixpkgs/trunk/; revision=21739
This commit is contained in:
parent
da7e1fbea3
commit
9ec34da2ee
@ -262,8 +262,8 @@ rec {
|
||||
declarations = map (x: toString x.source) opt.declarations;
|
||||
definitions = map (x: toString x.source) opt.definitions;
|
||||
}
|
||||
// optionalAttrs (opt ? example) { example = opt.example; }
|
||||
// optionalAttrs (opt ? default) { default = opt.default; };
|
||||
// optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
|
||||
// optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; };
|
||||
|
||||
subOptions =
|
||||
if opt ? options then
|
||||
@ -275,4 +275,16 @@ rec {
|
||||
) [] options;
|
||||
|
||||
|
||||
/* This function recursively removes all derivation attributes from
|
||||
`x' except for the `name' attribute. This is to make the
|
||||
generation of `options.xml' much more efficient: the XML
|
||||
representation of derivations is very large (on the order of
|
||||
megabytes) and is not actually used by the manual generator. */
|
||||
scrubOptionValue = x:
|
||||
if isDerivation x then { type = "derivation"; drvPath = x.name; name = x.name; }
|
||||
else if isList x then map scrubOptionValue x
|
||||
else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) x
|
||||
else x;
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user