1
0
Fork 0
nix-scripts/artiq-full/sipyco-manual.nix

57 lines
1.6 KiB
Nix
Raw Normal View History

2019-11-12 10:43:50 +08:00
{ stdenv, lib, python3Packages, texlive, texinfo, sipyco }:
let
2019-11-12 10:43:50 +08:00
version = sipyco.version;
isLatexPdfTarget = target: builtins.match "latexpdf.*" target != null;
latex = texlive.combine {
inherit (texlive)
scheme-basic latexmk cmap collection-fontsrecommended fncychap
titlesec tabulary varwidth framed fancyvrb float wrapfig parskip
upquote capt-of needspace etoolbox;
};
2019-11-12 10:43:50 +08:00
sipyco-manual = target: stdenv.mkDerivation rec {
name = "sipyco-manual-${target}-${version}";
inherit version;
2019-11-12 10:43:50 +08:00
src = sipyco.src;
buildInputs = [
python3Packages.sphinx python3Packages.sphinx_rtd_theme
2019-11-12 10:43:50 +08:00
python3Packages.sphinx-argparse sipyco
] ++
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
'';
makeFlags = [ target ];
installPhase =
let
2019-11-12 10:43:50 +08:00
dest = "$out/share/doc/sipyco-manual";
in
if isLatexPdfTarget target
then ''
mkdir -p ${dest}
2019-11-12 10:43:50 +08:00
cp _build/latex/SiPyCo.pdf ${dest}/
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
''
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
'';
};
targets = [ "html" "latexpdf" ];
in
2019-11-12 10:43:50 +08:00
builtins.listToAttrs (map (target: { name = "sipyco-manual-${target}"; value = sipyco-manual target; }) targets)