···
{ pkgs, options, version, revision, extraSources ? [] }:
# Remove invisible and internal options.
9
-
optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options);
9
+
optionsList = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options);
# Replace functions by the string <function>
13
-
if builtins.isAttrs x then mapAttrs (name: substFunction) x
13
+
if builtins.isAttrs x then lib.mapAttrs (name: substFunction) x
else if builtins.isList x then map substFunction x
else if builtins.isFunction x then "<function>"
# Clean up declaration sites to not refer to the NixOS source tree.
19
-
optionsList' = flip map optionsList (opt: opt // {
19
+
optionsList' = lib.flip map optionsList (opt: opt // {
declarations = map stripAnyPrefixes opt.declarations;
22
-
// optionalAttrs (opt ? example) { example = substFunction opt.example; }
23
-
// optionalAttrs (opt ? default) { default = substFunction opt.default; }
24
-
// optionalAttrs (opt ? type) { type = substFunction opt.type; });
22
+
// lib.optionalAttrs (opt ? example) { example = substFunction opt.example; }
23
+
// lib.optionalAttrs (opt ? default) { default = substFunction opt.default; }
24
+
// lib.optionalAttrs (opt ? type) { type = substFunction opt.type; });
# We need to strip references to /nix/store/* from options,
# including any `extraSources` if some modules came from elsewhere,
···
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
# you'd need to include `extraSources = [ pkgs.customModules ]`
prefixesToStrip = map (p: "${toString p}/") ([ ../../.. ] ++ extraSources);
33
-
stripAnyPrefixes = flip (fold removePrefix) prefixesToStrip;
33
+
stripAnyPrefixes = lib.flip (lib.fold lib.removePrefix) prefixesToStrip;
# Convert the list of options into an XML file.
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList');
···
-o $out ${./options-to-docbook.xsl} $optionsXML
52
-
sources = sourceFilesBySuffices ./. [".xml"];
52
+
sources = lib.sourceFilesBySuffices ./. [".xml"];
···
cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON
146
-
(listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList'))))
146
+
(builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList'))))
mkdir -p $out/nix-support
···
allowedReferences = ["out"];
197
+
manualEpub = stdenv.mkDerivation {
198
+
name = "nixos-manual-epub";
202
+
buildInputs = [ libxml2 libxslt zip ];
207
+
# Check the validity of the manual sources.
208
+
xmllint --noout --nonet --xinclude --noxincludenode \
209
+
--relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
212
+
# Generate the epub manual.
213
+
dst=$out/share/doc/nixos
216
+
${manualXsltprocOptions} \
217
+
--stringparam target.database.document "${olinkDB}/olinkdb.xml" \
218
+
--nonet --xinclude --output $dst/epub/ \
219
+
${docbook5_xsl}/xml/xsl/docbook/epub/docbook.xsl ./manual.xml
221
+
mkdir -p $dst/epub/OEBPS/images/callouts
222
+
cp -r ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/epub/OEBPS/images/callouts
223
+
echo "application/epub+zip" > mimetype
224
+
zip -0Xq "$dst/NixOS Manual - NixOS community.epub" mimetype
225
+
zip -Xr9D "$dst/NixOS Manual - NixOS community.epub" $dst/epub/*
227
+
mkdir -p $out/nix-support
228
+
echo "doc-epub manual $dst/NixOS Manual - NixOS community.epub" >> $out/nix-support/hydra-build-products
manualPDF = stdenv.mkDerivation {
name = "nixos-manual-pdf";