chromium: fetch src from git instead of using release tarball
[NixPkgs.git] / doc / doc-support / epub.nix
blob2b8d6b5f24704179f831c18114275e91fa1df40e
1 # To build this derivation, run `nix-build -A nixpkgs-manual.epub`
3   lib,
4   runCommand,
5   docbook_xsl_ns,
6   libxslt,
7   zip,
8 }:
9 runCommand "manual.epub"
10   {
11     nativeBuildInputs = [
12       libxslt
13       zip
14     ];
16     epub = ''
17       <book xmlns="http://docbook.org/ns/docbook"
18             xmlns:xlink="http://www.w3.org/1999/xlink"
19             version="5.0"
20             xml:id="nixpkgs-manual">
21         <info>
22           <title>Nixpkgs Manual</title>
23           <subtitle>Version ${lib.version}</subtitle>
24         </info>
25         <chapter>
26           <title>Temporarily unavailable</title>
27           <para>
28             The Nixpkgs manual is currently not available in EPUB format,
29             please use the <link xlink:href="https://nixos.org/nixpkgs/manual">HTML manual</link>
30             instead.
31           </para>
32           <para>
33             If you've used the EPUB manual in the past and it has been useful to you, please
34             <link xlink:href="https://github.com/NixOS/nixpkgs/issues/237234">let us know</link>.
35           </para>
36         </chapter>
37       </book>
38     '';
40     passAsFile = [ "epub" ];
41   }
42   ''
43     mkdir scratch
44     xsltproc \
45       --param chapter.autolabel 0 \
46       --nonet \
47       --output scratch/ \
48       ${docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl \
49       $epubPath
51     echo "application/epub+zip" > mimetype
52     zip -0Xq -b "$TMPDIR" "$out" mimetype
53     cd scratch && zip -Xr9D -b "$TMPDIR" "$out" *
54   ''