mirror of
https://github.com/NixOS/nix-pills
synced 2024-09-19 04:00:13 -04:00
build: Add EPUB support
You can get it by running `nix-build release.nix -A epub`
This commit is contained in:
parent
841d008f51
commit
49c3ae8720
|
@ -14,7 +14,7 @@ things as I go, in order to not get bogged down.
|
||||||
|
|
||||||
How I've built and tested:
|
How I've built and tested:
|
||||||
|
|
||||||
`nix-build release.nix && firefox result/share/doc/nix-pills/index.html`
|
`nix-build release.nix -A html-split && firefox result/share/doc/nix-pills/index.html`
|
||||||
|
|
||||||
Emacs config for a nice docbook experience:
|
Emacs config for a nice docbook experience:
|
||||||
|
|
||||||
|
|
105
default.nix
105
default.nix
|
@ -56,29 +56,94 @@ let
|
||||||
"--stringparam chunk.toc '${toc}'"
|
"--stringparam chunk.toc '${toc}'"
|
||||||
];
|
];
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in {
|
||||||
name = "nix-pills";
|
html-split = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "nix-pills";
|
||||||
|
|
||||||
src = sources;
|
src = sources;
|
||||||
buildInputs = with pkgs; [ libxslt ];
|
|
||||||
|
|
||||||
installPhase = ''
|
buildInputs = with pkgs; [
|
||||||
# Generate the HTML manual.
|
libxslt
|
||||||
dst=$out/share/doc/nix-pills
|
];
|
||||||
mkdir -p "$dst"
|
|
||||||
xsltproc \
|
|
||||||
${manualXsltprocOptions} \
|
|
||||||
--nonet --output "$dst/" \
|
|
||||||
"${pkgs.docbook-xsl-ns}/xml/xsl/docbook/xhtml/chunk.xsl" \
|
|
||||||
"${combined}"
|
|
||||||
|
|
||||||
mkdir -p "$dst/images/callouts"
|
installPhase = ''
|
||||||
cp -r "${pkgs.docbook-xsl-ns}/xml/xsl/docbook/images/callouts"/*.svg "$dst/images/callouts"
|
runHook preInstall
|
||||||
|
|
||||||
cp "${./style.css}" "$dst/style.css"
|
# Generate the HTML manual.
|
||||||
|
dst=$out/share/doc/nix-pills
|
||||||
|
mkdir -p "$dst"
|
||||||
|
xsltproc \
|
||||||
|
${manualXsltprocOptions} \
|
||||||
|
--nonet --output "$dst/" \
|
||||||
|
"${pkgs.docbook-xsl-ns}/xml/xsl/docbook/xhtml/chunk.xsl" \
|
||||||
|
"${combined}"
|
||||||
|
|
||||||
mkdir -p "$out/nix-support"
|
mkdir -p "$dst/images/callouts"
|
||||||
echo "nix-build out $out" >> "$out/nix-support/hydra-build-products"
|
cp -r "${pkgs.docbook-xsl-ns}/xml/xsl/docbook/images/callouts"/*.svg "$dst/images/callouts"
|
||||||
echo "doc nix-pills $dst" >> "$out/nix-support/hydra-build-products"
|
|
||||||
'';
|
cp "${./style.css}" "$dst/style.css"
|
||||||
|
|
||||||
|
mkdir -p "$out/nix-support"
|
||||||
|
echo "nix-build out $out" >> "$out/nix-support/hydra-build-products"
|
||||||
|
echo "doc nix-pills $dst" >> "$out/nix-support/hydra-build-products"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
epub = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "nix-pills-epub";
|
||||||
|
|
||||||
|
src = sources;
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
libxslt
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
|
||||||
|
installCheckInputs = with pkgs; [
|
||||||
|
epubcheck
|
||||||
|
];
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
# Generate the EPUB manual.
|
||||||
|
dst=$out/share/doc/nix-pills
|
||||||
|
mkdir -p "$dst"
|
||||||
|
xsltproc \
|
||||||
|
${manualXsltprocOptions} \
|
||||||
|
--nonet --output "$dst/epub/" \
|
||||||
|
"${pkgs.docbook-xsl-ns}/xml/xsl/docbook/epub3/chunk.xsl" \
|
||||||
|
"${combined}"
|
||||||
|
|
||||||
|
mkdir -p "$dst/epub/OEBPS/images/callouts"
|
||||||
|
cp -r "${pkgs.docbook-xsl-ns}/xml/xsl/docbook/images/callouts"/*.svg "$dst/epub/OEBPS/images/callouts"
|
||||||
|
cp "${./style.css}" "$dst/epub/OEBPS/style.css"
|
||||||
|
|
||||||
|
echo "application/epub+zip" > mimetype
|
||||||
|
manual="$dst/nix-pills.epub"
|
||||||
|
zip -0Xq "$manual" mimetype
|
||||||
|
pushd "$dst/epub" && zip -Xr9D "$manual" *
|
||||||
|
popd
|
||||||
|
|
||||||
|
rm -rf "$dst/epub"
|
||||||
|
|
||||||
|
mkdir -p "$out/nix-support"
|
||||||
|
echo "nix-build out $out" >> "$out/nix-support/hydra-build-products"
|
||||||
|
echo "doc-epub nix-pills $manual" >> "$out/nix-support/hydra-build-products"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
installCheckPhase = ''
|
||||||
|
runHook preInstallCheck
|
||||||
|
|
||||||
|
epubcheck "$manual"
|
||||||
|
|
||||||
|
runHook postInstallCheck
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
11
release.nix
11
release.nix
|
@ -5,17 +5,20 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
pkgs = import <nixpkgs> { };
|
pkgs = import <nixpkgs> { };
|
||||||
in rec {
|
|
||||||
html-split = import ./default.nix {
|
pills = import ./default.nix {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
||||||
inherit (nix-pills) revCount shortRev;
|
inherit (nix-pills) revCount shortRev;
|
||||||
};
|
};
|
||||||
|
in rec {
|
||||||
|
inherit (pills) html-split epub;
|
||||||
release = pkgs.releaseTools.aggregate
|
release = pkgs.releaseTools.aggregate
|
||||||
{ name = "nix-pills-release";
|
{ name = "nix-pills-release";
|
||||||
constituents =
|
constituents =
|
||||||
[ html-split
|
[
|
||||||
|
html-split
|
||||||
|
epub
|
||||||
];
|
];
|
||||||
meta.description = "All build outputs";
|
meta.description = "All build outputs";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue