anchor.diff:        allowedReferences = ["out"];
       }
       ''
  -      ${copySources}
  -
  -      # Check the validity of the manual sources.
  -      xmllint --noout --nonet --xinclude --noxincludenode \
  -        --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
  -        manual.xml
  -
         # Generate the HTML manual.
         dst=$out/share/doc/nixos
         mkdir -p $dst
         xsltproc \
           ${manualXsltprocOptions} \
           --stringparam target.database.document "${olinkDB}/olinkdb.xml" \
  -        --nonet --xinclude --output $dst/ \
  -        ${docbook5_xsl}/xml/xsl/docbook/xhtml/chunktoc.xsl ./manual.xml
  +        --nonet --output $dst/ \
  +        ${docbook5_xsl}/xml/xsl/docbook/xhtml/chunktoc.xsl \
  +        ${manual-combined}/manual-combined.xml
   
         mkdir -p $dst/images/callouts
         cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
  
positive.code:         ${manualXsltprocOptions} \
          --stringparam target.database.document "${olinkDB}/olinkdb.xml" \
          --nonet --xinclude --output $dst/epub/ \
          ${docbook5_xsl}/xml/xsl/docbook/epub/docbook.xsl ./manual.xml
  
        mkdir -p $dst/epub/OEBPS/images/callouts
        cp -r ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/epub/OEBPS/images/callouts
        echo "application/epub+zip" > mimetype
        manual="$dst/nixos-manual.epub"
        zip -0Xq "$manual" mimetype
  
negative.code:     "--stringparam chunk.toc ${toc}"
    ];
  
    manual-combined = runCommand "nixos-manual-combined"
      { inherit sources;
        buildInputs = [ libxml2 libxslt ];
        meta.description = "The NixOS manual as plain docbook XML";
      }
      ''
        ${copySources}
  
        xmllint --xinclude --output ./manual-combined.xml ./manual.xml
        xmllint --xinclude --noxincludenode \
           --output ./man-pages-combined.xml ./man-pages.xml
  
        xmllint --debug --noout --nonet \
          --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
          manual-combined.xml
        xmllint --debug --noout --nonet \
          --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
          man-pages-combined.xml
  
  
        mkdir $out
        cp manual-combined.xml $out/
        cp man-pages-combined.xml $out/
      '';
  
    olinkDB = runCommand "manual-olinkdb"
      { inherit sources;
        buildInputs = [ libxml2 libxslt ];
      }
      ''
        xsltproc \
          ${manualXsltprocOptions} \
          --stringparam collect.xref.targets only \
          --stringparam targets.filename "$out/manual.db" \
          --nonet \
          ${docbook5_xsl}/xml/xsl/docbook/xhtml/chunktoc.xsl \
          ${manual-combined}/manual-combined.xml
  
        cat > "$out/olinkdb.xml" <<EOF
        <?xml version="1.0" encoding="utf-8"?>
  