2009-08-21 11:08:55 +02:00
|
|
|
{ pkgs, optionDeclarations }:
|
2008-06-05 17:33:17 +02:00
|
|
|
|
2008-01-04 15:24:42 +01:00
|
|
|
let
|
|
|
|
|
2009-06-05 17:04:58 +02:00
|
|
|
manualConfig =
|
|
|
|
{ environment.checkConfigurationOptions = false;
|
2009-07-14 18:27:46 +02:00
|
|
|
services.nixosManual.enable = false;
|
2009-06-05 17:04:58 +02:00
|
|
|
};
|
2008-01-04 15:24:42 +01:00
|
|
|
|
2009-08-21 11:08:55 +02:00
|
|
|
# To prevent infinite recursion, remove system.path from the
|
|
|
|
# options. Not sure why this happens.
|
|
|
|
optionDeclarations_ =
|
|
|
|
optionDeclarations //
|
|
|
|
{ system = removeAttrs optionDeclarations.system ["path"]; };
|
|
|
|
|
2008-01-04 15:24:42 +01:00
|
|
|
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
2009-08-21 11:08:55 +02:00
|
|
|
(builtins.toXML (pkgs.lib.optionAttrSetToDocList "" optionDeclarations_)));
|
2008-01-04 15:24:42 +01:00
|
|
|
|
|
|
|
optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
|
|
|
|
${pkgs.libxslt}/bin/xsltproc -o $out ${./options-to-docbook.xsl} ${options}
|
|
|
|
'';
|
|
|
|
|
|
|
|
manual = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "nixos-manual";
|
|
|
|
|
|
|
|
sources = pkgs.lib.sourceFilesBySuffices ./. [".xml"];
|
|
|
|
|
|
|
|
buildInputs = [pkgs.libxslt];
|
|
|
|
|
|
|
|
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 17:47:03 +02:00
|
|
|
|
2008-01-04 15:24:42 +01:00
|
|
|
ln -s $sources/*.xml .
|
|
|
|
ln -s ${optionsDocBook} options-db.xml
|
2009-07-14 17:47:03 +02:00
|
|
|
|
|
|
|
dst=$out/share/doc/nixos
|
|
|
|
ensureDir $dst
|
2008-01-04 15:24:42 +01:00
|
|
|
xsltproc $xsltFlags --nonet --xinclude \
|
2009-07-14 17:47:03 +02:00
|
|
|
--output $dst/manual.html \
|
2009-06-05 19:16:42 +02:00
|
|
|
${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
|
2008-01-04 15:24:42 +01:00
|
|
|
./manual.xml
|
2009-07-14 17:47:03 +02:00
|
|
|
ln -s ${pkgs.docbook5_xsl}/xml/xsl/docbook/images $dst/
|
|
|
|
cp ${./style.css} $dst/style.css
|
|
|
|
|
|
|
|
ensureDir $out/share/man
|
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
--param man.output.in.separate.dir 1 \
|
|
|
|
--param man.output.base.dir "'$out/share/man/'" \
|
|
|
|
${pkgs.docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
|
|
|
|
./man-pages.xml
|
2009-07-14 15:31:32 +02:00
|
|
|
|
2008-12-17 14:25:23 +01:00
|
|
|
ensureDir $out/nix-support
|
2009-07-14 17:47:03 +02:00
|
|
|
echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
|
2008-01-04 15:24:42 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in manual
|