* Build the Nix manual in a Nix expression instead of a Makefile so

that it becomes easier to include it on the CD.

svn path=/nixos/trunk/; revision=10070
This commit is contained in:
Eelco Dolstra 2008-01-04 14:24:42 +00:00
parent 8f0e88d4e5
commit e9a7f80681
2 changed files with 42 additions and 22 deletions

View File

@ -1,22 +0,0 @@
XMLLINT = xmllint --catalogs
XSLTPROC = xsltproc --catalogs \
--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\'
docbookxsl = $(HOME)/.nix-profile/xml/xsl/docbook
manual.html: *.xml options-db.xml
$(XSLTPROC) --nonet --xinclude --output $@ \
$(docbookxsl)/html/docbook.xsl manual.xml
options-db.xml: options.xml options-to-docbook.xsl
xsltproc -o options-db.xml options-to-docbook.xsl options.xml
options.xml: ../../system/options.nix
echo '((pkgs:(pkgs.lib.optionAttrSetToDocList "" (import ../../system/options.nix {pkgs = pkgs; mkOption = pkgs.lib.mkOption; }))) (import ../../pkgs/top-level/all-packages.nix {}))' | \
nix-instantiate --eval-only --xml --strict - > options.xml || (rm options.xml && false)

42
doc/manual/default.nix Normal file
View File

@ -0,0 +1,42 @@
let
pkgs = import ../../pkgs/top-level/all-packages.nix {};
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
(builtins.toXML (pkgs.lib.optionAttrSetToDocList ""
(import ../../system/options.nix {pkgs = pkgs; mkOption = pkgs.lib.mkOption;}))));
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 = ''
ensureDir $out
ln -s $sources/*.xml .
ln -s ${optionsDocBook} options-db.xml
xsltproc $xsltFlags --nonet --xinclude \
--output $out/manual.html \
${pkgs.docbook5_xsl}/xml/xsl/docbook/html/docbook.xsl \
./manual.xml
cp ${./style.css} $out/style.css
'';
};
in manual