2019-04-24 15:05:29 +08:00
|
|
|
{ stdenv, lib, fetchgit, git, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }:
|
2019-02-26 16:38:16 +08:00
|
|
|
|
|
|
|
let
|
2019-07-17 20:02:06 +08:00
|
|
|
artiqVersion = import <artiq-fast/artiq-version.nix> { inherit stdenv fetchgit git; };
|
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
|
|
|
};
|
|
|
|
|
|
|
|
artiq-manual = target: stdenv.mkDerivation rec {
|
2019-02-26 18:34:30 +08:00
|
|
|
name = "artiq-manual-${target}-${version}";
|
2019-02-26 16:38:16 +08:00
|
|
|
version = artiqVersion;
|
|
|
|
|
2019-07-17 20:02:06 +08:00
|
|
|
src = import <artiq-fast/artiq-src.nix> { inherit fetchgit; };
|
2019-02-26 16:38:16 +08:00
|
|
|
buildInputs = [
|
2019-02-26 17:28:44 +08:00
|
|
|
python3Packages.sphinx python3Packages.sphinx_rtd_theme
|
2019-04-23 11:06:32 +08:00
|
|
|
python3Packages.sphinx-argparse sphinxcontrib-wavedrom
|
2019-02-26 16:38:16 +08:00
|
|
|
] ++
|
|
|
|
lib.optional (isLatexPdfTarget target) latex ++
|
|
|
|
lib.optional (target == "texinfo") texinfo;
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export VERSIONEER_OVERRIDE=${artiqVersion}
|
2019-07-17 20:02:06 +08:00
|
|
|
export SOURCE_DATE_EPOCH=${import <artiq-fast/artiq-timestamp.nix> { inherit stdenv fetchgit git; }}
|
2019-02-26 16:38:16 +08:00
|
|
|
cd doc/manual
|
|
|
|
'';
|
|
|
|
makeFlags = [ target ];
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
let
|
|
|
|
dest = "$out/share/doc/artiq-manual";
|
|
|
|
in
|
|
|
|
if isLatexPdfTarget target
|
|
|
|
then ''
|
|
|
|
mkdir -p ${dest}
|
|
|
|
cp _build/latex/ARTIQ.pdf ${dest}/
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support/
|
|
|
|
echo doc-pdf manual ${dest} ARTIQ.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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2019-04-23 11:06:32 +08:00
|
|
|
targets = [ "html" "latexpdf" ];
|
2019-02-26 16:38:16 +08:00
|
|
|
in
|
2019-02-26 18:32:07 +08:00
|
|
|
builtins.listToAttrs (map (target: { name = "artiq-manual-${target}"; value = artiq-manual target; }) targets)
|