doc: extract epub manual stub into its own package
This commit is contained in:
parent
87b8931d74
commit
ee6a243ea4
@ -10,47 +10,7 @@ let
|
|||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
epub = pkgs.runCommand "manual.epub" {
|
epub = callPackage ./doc-support/epub.nix { };
|
||||||
nativeBuildInputs = with pkgs; [ libxslt zip ];
|
|
||||||
|
|
||||||
epub = ''
|
|
||||||
<book xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
version="5.0"
|
|
||||||
xml:id="nixpkgs-manual">
|
|
||||||
<info>
|
|
||||||
<title>Nixpkgs Manual</title>
|
|
||||||
<subtitle>Version ${pkgs.lib.version}</subtitle>
|
|
||||||
</info>
|
|
||||||
<chapter>
|
|
||||||
<title>Temporarily unavailable</title>
|
|
||||||
<para>
|
|
||||||
The Nixpkgs manual is currently not available in EPUB format,
|
|
||||||
please use the <link xlink:href="https://nixos.org/nixpkgs/manual">HTML manual</link>
|
|
||||||
instead.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
If you've used the EPUB manual in the past and it has been useful to you, please
|
|
||||||
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/237234">let us know</link>.
|
|
||||||
</para>
|
|
||||||
</chapter>
|
|
||||||
</book>
|
|
||||||
'';
|
|
||||||
|
|
||||||
passAsFile = [ "epub" ];
|
|
||||||
} ''
|
|
||||||
mkdir scratch
|
|
||||||
xsltproc \
|
|
||||||
--param chapter.autolabel 0 \
|
|
||||||
--nonet \
|
|
||||||
--output scratch/ \
|
|
||||||
${pkgs.docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl \
|
|
||||||
$epubPath
|
|
||||||
|
|
||||||
echo "application/epub+zip" > mimetype
|
|
||||||
zip -0Xq -b "$TMPDIR" "$out" mimetype
|
|
||||||
cd scratch && zip -Xr9D -b "$TMPDIR" "$out" *
|
|
||||||
'';
|
|
||||||
|
|
||||||
# NB: This file describes the Nixpkgs manual, which happens to use module
|
# NB: This file describes the Nixpkgs manual, which happens to use module
|
||||||
# docs infra originally developed for NixOS.
|
# docs infra originally developed for NixOS.
|
||||||
|
53
doc/doc-support/epub.nix
Normal file
53
doc/doc-support/epub.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
runCommand,
|
||||||
|
docbook_xsl_ns,
|
||||||
|
libxslt,
|
||||||
|
zip,
|
||||||
|
}:
|
||||||
|
runCommand "manual.epub"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
libxslt
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
|
||||||
|
epub = ''
|
||||||
|
<book xmlns="http://docbook.org/ns/docbook"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
version="5.0"
|
||||||
|
xml:id="nixpkgs-manual">
|
||||||
|
<info>
|
||||||
|
<title>Nixpkgs Manual</title>
|
||||||
|
<subtitle>Version ${lib.version}</subtitle>
|
||||||
|
</info>
|
||||||
|
<chapter>
|
||||||
|
<title>Temporarily unavailable</title>
|
||||||
|
<para>
|
||||||
|
The Nixpkgs manual is currently not available in EPUB format,
|
||||||
|
please use the <link xlink:href="https://nixos.org/nixpkgs/manual">HTML manual</link>
|
||||||
|
instead.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
If you've used the EPUB manual in the past and it has been useful to you, please
|
||||||
|
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/237234">let us know</link>.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
</book>
|
||||||
|
'';
|
||||||
|
|
||||||
|
passAsFile = [ "epub" ];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
mkdir scratch
|
||||||
|
xsltproc \
|
||||||
|
--param chapter.autolabel 0 \
|
||||||
|
--nonet \
|
||||||
|
--output scratch/ \
|
||||||
|
${docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl \
|
||||||
|
$epubPath
|
||||||
|
|
||||||
|
echo "application/epub+zip" > mimetype
|
||||||
|
zip -0Xq -b "$TMPDIR" "$out" mimetype
|
||||||
|
cd scratch && zip -Xr9D -b "$TMPDIR" "$out" *
|
||||||
|
''
|
Loading…
Reference in New Issue
Block a user