2009-09-18 19:10:32 +04:00
|
|
|
{ pkgs, options
|
|
|
|
# revision can have multiple values: local, HEAD or any revision number.
|
|
|
|
, revision ? "HEAD"
|
|
|
|
}:
|
2008-06-05 19:33:17 +04:00
|
|
|
|
2008-01-04 17:24:42 +03:00
|
|
|
let
|
2009-10-06 03:15:06 +04:00
|
|
|
|
2009-08-21 13:08:55 +04:00
|
|
|
# To prevent infinite recursion, remove system.path from the
|
|
|
|
# options. Not sure why this happens.
|
2009-09-15 18:09:18 +04:00
|
|
|
options_ =
|
|
|
|
options //
|
|
|
|
{ system = removeAttrs options.system ["path"]; };
|
2009-08-21 13:08:55 +04:00
|
|
|
|
2009-10-06 03:47:50 +04:00
|
|
|
optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
2009-09-15 18:09:18 +04:00
|
|
|
(builtins.toXML (pkgs.lib.optionAttrSetToDocList "" options_)));
|
2008-01-04 17:24:42 +03:00
|
|
|
|
|
|
|
optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
|
2009-10-06 03:47:50 +04:00
|
|
|
${pkgs.libxslt}/bin/xsltproc \
|
|
|
|
--stringparam revision '${revision}' \
|
|
|
|
-o $out ${./options-to-docbook.xsl} ${optionsXML}
|
2008-01-04 17:24:42 +03:00
|
|
|
'';
|
2009-09-18 19:10:37 +04:00
|
|
|
|
2008-01-04 17:24:42 +03:00
|
|
|
manual = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "nixos-manual";
|
|
|
|
|
|
|
|
sources = pkgs.lib.sourceFilesBySuffices ./. [".xml"];
|
|
|
|
|
2009-11-05 01:44:40 +03:00
|
|
|
buildInputs = [pkgs.libxml2 pkgs.libxslt];
|
2008-01-04 17:24:42 +03:00
|
|
|
|
|
|
|
xsltFlags = ''
|
|
|
|
--param section.autolabel 1
|
|
|
|
--param section.label.includes.component.label 1
|
|
|
|
--param html.stylesheet 'style.css'
|
|
|
|
--param xref.with.number.and.title 1
|
|
|
|
--param toc.section.depth 3
|
|
|
|
--param admon.style '''
|
|
|
|
--param callout.graphics.extension '.gif'
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildCommand = ''
|
2009-07-14 19:47:03 +04:00
|
|
|
|
2009-09-18 19:10:32 +04:00
|
|
|
ln -s $sources/*.xml . # */
|
2008-01-04 17:24:42 +03:00
|
|
|
ln -s ${optionsDocBook} options-db.xml
|
2009-07-14 19:47:03 +04:00
|
|
|
|
2009-10-05 17:17:45 +04:00
|
|
|
# Check the validity of the manual sources.
|
|
|
|
xmllint --noout --nonet --xinclude --noxincludenode \
|
|
|
|
--relaxng ${pkgs.docbook5}/xml/rng/docbook/docbook.rng \
|
|
|
|
manual.xml
|
|
|
|
|
|
|
|
# Generate the HTML manual.
|
2009-07-14 19:47:03 +04:00
|
|
|
dst=$out/share/doc/nixos
|
|
|
|
ensureDir $dst
|
2008-01-04 17:24:42 +03:00
|
|
|
xsltproc $xsltFlags --nonet --xinclude \
|
2009-10-06 03:15:06 +04:00
|
|
|
--output $dst/manual.html \
|
2009-06-05 21:16:42 +04:00
|
|
|
${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
|
2008-01-04 17:24:42 +03:00
|
|
|
./manual.xml
|
2009-09-18 19:10:37 +04:00
|
|
|
|
2009-07-14 19:47:03 +04:00
|
|
|
ln -s ${pkgs.docbook5_xsl}/xml/xsl/docbook/images $dst/
|
|
|
|
cp ${./style.css} $dst/style.css
|
|
|
|
|
2009-10-05 17:17:45 +04:00
|
|
|
# Generate manpages.
|
2009-07-14 19:47:03 +04:00
|
|
|
ensureDir $out/share/man
|
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
--param man.output.in.separate.dir 1 \
|
|
|
|
--param man.output.base.dir "'$out/share/man/'" \
|
2009-10-06 03:15:06 +04:00
|
|
|
--param man.endnotes.are.numbered 0 \
|
2009-07-14 19:47:03 +04:00
|
|
|
${pkgs.docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
|
|
|
|
./man-pages.xml
|
2009-07-14 17:31:32 +04:00
|
|
|
|
2008-12-17 16:25:23 +03:00
|
|
|
ensureDir $out/nix-support
|
2009-07-14 19:47:03 +04:00
|
|
|
echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
|
2008-01-04 17:24:42 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in manual
|