2019-11-12 10:43:50 +08:00
|
|
|
{ stdenv, lib, python3Packages, texlive, texinfo, sipyco }:
|
2019-02-26 16:38:16 +08:00
|
|
|
|
|
|
|
let
|
2019-11-12 10:43:50 +08:00
|
|
|
version = sipyco.version;
|
2019-02-26 16:38:16 +08:00
|
|
|
|
2019-02-26 17:28:44 +08:00
|
|
|
isLatexPdfTarget = target: builtins.match "latexpdf.*" target != null;
|
2019-02-26 16:38:16 +08:00
|
|
|
|
|
|
|
latex = texlive.combine {
|
|
|
|
inherit (texlive)
|
|
|
|
scheme-basic latexmk cmap collection-fontsrecommended fncychap
|
|
|
|
titlesec tabulary varwidth framed fancyvrb float wrapfig parskip
|
2019-04-12 17:56:01 +08:00
|
|
|
upquote capt-of needspace etoolbox;
|
2019-02-26 16:38:16 +08:00
|
|
|
};
|
|
|
|
|
2019-11-12 10:43:50 +08:00
|
|
|
sipyco-manual = target: stdenv.mkDerivation rec {
|
|
|
|
name = "sipyco-manual-${target}-${version}";
|
|
|
|
inherit version;
|
2019-02-26 16:38:16 +08:00
|
|
|
|
2019-11-12 10:43:50 +08:00
|
|
|
src = sipyco.src;
|
2019-02-26 16:38:16 +08:00
|
|
|
buildInputs = [
|
2019-02-26 17:28:44 +08:00
|
|
|
python3Packages.sphinx python3Packages.sphinx_rtd_theme
|
2019-11-12 10:43:50 +08:00
|
|
|
python3Packages.sphinx-argparse sipyco
|
2019-02-26 16:38:16 +08:00
|
|
|
] ++
|
|
|
|
lib.optional (isLatexPdfTarget target) latex ++
|
|
|
|
lib.optional (target == "texinfo") texinfo;
|
|
|
|
|
|
|
|
preBuild = ''
|
2019-11-12 10:43:50 +08:00
|
|
|
export SOURCE_DATE_EPOCH=200000
|
|
|
|
cd doc
|
2019-02-26 16:38:16 +08:00
|
|
|
'';
|
|
|
|
makeFlags = [ target ];
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
let
|
2019-11-12 10:43:50 +08:00
|
|
|
dest = "$out/share/doc/sipyco-manual";
|
2019-02-26 16:38:16 +08:00
|
|
|
in
|
|
|
|
if isLatexPdfTarget target
|
|
|
|
then ''
|
|
|
|
mkdir -p ${dest}
|
2019-11-12 10:43:50 +08:00
|
|
|
cp _build/latex/SiPyCo.pdf ${dest}/
|
2019-02-26 16:38:16 +08:00
|
|
|
|
|
|
|
mkdir -p $out/nix-support/
|
2019-11-12 10:43:50 +08:00
|
|
|
echo doc-pdf manual ${dest} SiPyCo.pdf >> $out/nix-support/hydra-build-products
|
2019-02-26 16:38:16 +08:00
|
|
|
''
|
|
|
|
else ''
|
|
|
|
mkdir -p ${dest}
|
|
|
|
cp -r _build/${target} ${dest}/
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support/
|
|
|
|
echo doc manual ${dest}/${target} index.html >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2019-04-23 11:06:32 +08:00
|
|
|
targets = [ "html" "latexpdf" ];
|
2019-02-26 16:38:16 +08:00
|
|
|
in
|
2019-11-12 10:43:50 +08:00
|
|
|
builtins.listToAttrs (map (target: { name = "sipyco-manual-${target}"; value = sipyco-manual target; }) targets)
|