···
+
prepareManualFromMD = ''
+
cp -r --no-preserve=all $inputs/* .
+
substituteInPlace ./manual.md \
+
--replace '@NIXOS_VERSION@' "${version}"
+
substituteInPlace ./configuration/configuration.md \
+
${lib.escapeShellArg (lib.concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
+
substituteInPlace ./nixos-options.md \
+
'@NIXOS_OPTIONS_JSON@' \
+
${optionsDoc.optionsJSON}/share/doc/nixos/options.json
+
substituteInPlace ./development/writing-nixos-tests.section.md \
+
'@NIXOS_TEST_OPTIONS_JSON@' \
+
${testOptionsDoc.optionsJSON}/share/doc/nixos/options.json
manual-combined = runCommand "nixos-manual-combined"
{ inputs = lib.sourceFilesBySuffices ./. [ ".xml" ".md" ];
nativeBuildInputs = [ pkgs.nixos-render-docs pkgs.libxml2.bin pkgs.libxslt.bin ];
meta.description = "The NixOS manual as plain docbook XML";
nixos-render-docs -j $NIX_BUILD_CORES manual docbook \
--manpage-urls ${manpageUrls} \
···
# Generate the NixOS manual.
manualHTML = runCommand "nixos-manual-html"
+
buildPackages.libxml2.bin
+
buildPackages.libxslt.bin
+
buildPackages.nixos-render-docs
+
inputs = lib.optionals (! allowDocBook) (lib.sourceFilesBySuffices ./. [ ".md" ]);
meta.description = "The NixOS manual in HTML format";
allowedReferences = ["out"];
···
# Generate the HTML manual.
cp ${../../../doc/style.css} $dst/style.css
cp ${../../../doc/overrides.css} $dst/overrides.css
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
+
${if allowDocBook then ''
+
${manualXsltprocOptions} \
+
--stringparam id.warnings "1" \
+
--nonet --output $dst/ \
+
${docbook_xsl_ns}/xml/xsl/docbook/xhtml/chunktoc.xsl \
+
${manual-combined}/manual-combined.xml \
+
grep "^ID recommended on" xsltproc.out &>/dev/null && echo "error: some IDs are missing" && false
+
mkdir -p $dst/images/callouts
+
cp ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
+
# TODO generator is set like this because the docbook/md manual compare workflow will
+
# trigger if it's different
+
nixos-render-docs -j $NIX_BUILD_CORES manual html \
+
--manpage-urls ${manpageUrls} \
+
--revision ${lib.escapeShellArg revision} \
+
--generator "DocBook XSL Stylesheets V${docbook_xsl_ns.version}" \
+
--stylesheet style.css \
+
--stylesheet overrides.css \
+
--stylesheet highlightjs/mono-blue.css \
+
--script ./highlightjs/highlight.pack.js \
+
--script ./highlightjs/loader.js \
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products