1with import ./.. { };
2with lib;
3
4stdenv.mkDerivation {
5 name = "nixpkgs-manual";
6
7 sources = sourceFilesBySuffices ./. [".xml"];
8
9 buildInputs = [ pandoc libxml2 libxslt ];
10
11 xsltFlags = ''
12 --param section.autolabel 1
13 --param section.label.includes.component.label 1
14 --param html.stylesheet 'style.css'
15 --param xref.with.number.and.title 1
16 --param toc.section.depth 3
17 --param admon.style '''
18 --param callout.graphics.extension '.gif'
19 '';
20
21 buildCommand = ''
22 {
23 echo "<chapter xmlns=\"http://docbook.org/ns/docbook\""
24 echo " xmlns:xlink=\"http://www.w3.org/1999/xlink\""
25 echo " xml:id=\"users-guide-to-the-haskell-infrastructure\">"
26 echo ""
27 echo "<title>User's Guide to the Haskell Infrastructure</title>"
28 echo ""
29 pandoc ${./haskell-users-guide.md} -w docbook | \
30 sed -e 's|<ulink url=|<link xlink:href=|' \
31 -e 's|</ulink>|</link>|' \
32 -e 's|<sect. id=|<section xml:id=|' \
33 -e 's|</sect[0-9]>|</section>|'
34 echo ""
35 echo "</chapter>"
36 } >haskell-users-guide.xml
37
38 ln -s "$sources/"*.xml .
39
40 echo ${nixpkgsVersion} > .version
41
42 xmllint --noout --nonet --xinclude --noxincludenode \
43 --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
44 manual.xml
45
46 dst=$out/share/doc/nixpkgs
47 mkdir -p $dst
48 xsltproc $xsltFlags --nonet --xinclude \
49 --output $dst/manual.html \
50 ${docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
51 ./manual.xml
52
53 cp ${./style.css} $dst/style.css
54
55 mkdir -p $dst/images/callouts
56 cp "${docbook5_xsl}/xml/xsl/docbook/images/callouts/"*.gif $dst/images/callouts/
57
58 mkdir -p $out/nix-support
59 echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
60 '';
61}