From 57b817f07e5d33e1670b2451880171f8e19a04b7 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 12 Nov 2019 10:43:50 +0800 Subject: [PATCH] build sipyco manual --- artiq-fast/pkgs/python-deps.nix | 4 +- artiq-full.nix | 8 ++- artiq-full/{manual.nix => artiq-manual.nix} | 0 artiq-full/sipyco-manual.nix | 56 +++++++++++++++++++++ nixbld-etc-nixos/configuration.nix | 16 +++++- 5 files changed, 79 insertions(+), 5 deletions(-) rename artiq-full/{manual.nix => artiq-manual.nix} (100%) create mode 100644 artiq-full/sipyco-manual.nix diff --git a/artiq-fast/pkgs/python-deps.nix b/artiq-fast/pkgs/python-deps.nix index 84c7717..b0c6c99 100644 --- a/artiq-fast/pkgs/python-deps.nix +++ b/artiq-fast/pkgs/python-deps.nix @@ -8,8 +8,8 @@ rec { src = fetchFromGitHub { owner = "m-labs"; repo = "sipyco"; - rev = "9468933f8ca5711493831439651b2f66b0125189"; - sha256 = "191782l0yhgsli50rkc7w4bhb87lf20gr89f4w5ibdxq1k38l8ii"; + rev = "09f7a7879f889d0d5d44c277513caca4d03dea0d"; + sha256 = "1wwmw3i935cip6s44a6dps7vbycnxwhwqplqi18iv50rc9ixdf5h"; }; propagatedBuildInputs = with python3Packages; [ numpy ]; }; diff --git a/artiq-full.nix b/artiq-full.nix index a8a615b..9edb383 100644 --- a/artiq-full.nix +++ b/artiq-full.nix @@ -206,11 +206,15 @@ let EOF ''; pythonDeps = import ./artiq-full/python-deps.nix { inherit pkgs; }; - manualPackages = import ./artiq-full/manual.nix { + sipycoManualPackages = import ./artiq-full/sipyco-manual.nix { + inherit (pkgs) stdenv lib python3Packages texlive texinfo; + inherit (import { inherit pkgs; }) sipyco; + }; + artiqManualPackages = import ./artiq-full/artiq-manual.nix { inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo; inherit (pythonDeps) sphinxcontrib-wavedrom; }; - jobs = (import generatedNix { inherit pkgs; }) // manualPackages // { + jobs = (import generatedNix { inherit pkgs; }) // sipycoManualPackages // artiqManualPackages // { # This is in the example in the ARTIQ manual - precompile it to speed up # installation for users. matplotlib-qt = pkgs.lib.hydraJob (pkgs.python3Packages.matplotlib.override { enableQt = true; }); diff --git a/artiq-full/manual.nix b/artiq-full/artiq-manual.nix similarity index 100% rename from artiq-full/manual.nix rename to artiq-full/artiq-manual.nix diff --git a/artiq-full/sipyco-manual.nix b/artiq-full/sipyco-manual.nix new file mode 100644 index 0000000..dd27dfd --- /dev/null +++ b/artiq-full/sipyco-manual.nix @@ -0,0 +1,56 @@ +{ stdenv, lib, python3Packages, texlive, texinfo, sipyco }: + +let + 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; + }; + + sipyco-manual = target: stdenv.mkDerivation rec { + name = "sipyco-manual-${target}-${version}"; + inherit version; + + src = sipyco.src; + buildInputs = [ + python3Packages.sphinx python3Packages.sphinx_rtd_theme + python3Packages.sphinx-argparse sipyco + ] ++ + lib.optional (isLatexPdfTarget target) latex ++ + lib.optional (target == "texinfo") texinfo; + + preBuild = '' + export SOURCE_DATE_EPOCH=200000 + cd doc + ''; + makeFlags = [ target ]; + + installPhase = + let + dest = "$out/share/doc/sipyco-manual"; + in + if isLatexPdfTarget target + then '' + mkdir -p ${dest} + cp _build/latex/SiPyCo.pdf ${dest}/ + + mkdir -p $out/nix-support/ + 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 + builtins.listToAttrs (map (target: { name = "sipyco-manual-${target}"; value = sipyco-manual target; }) targets) diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 47b38ed..fea9ed4 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -250,6 +250,14 @@ ACTION=="add", SUBSYSTEM=="tty", \ job = web:web:web command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/web + + job = artiq:full:sipyco-manual-html + command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/sipyco-manual-html + + + job = artiq:full:sipyco-manual-latexpdf + command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/sipyco-manual-latexpdf + job = artiq:full:artiq-manual-html command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-manual-html-beta @@ -395,7 +403,13 @@ ACTION=="add", SUBSYSTEM=="tty", \ return 301 /experiment-control/resources/; ''; - # autogenerated ARTIQ manuals + # autogenerated manuals + locations."/artiq/sipyco-manual/" = { + alias = "${hydraWwwOutputs}/sipyco-manual-html-beta/share/doc/sipyco-manual/html/"; + }; + locations."=/artiq/sipyco-manual.pdf" = { + alias = "${hydraWwwOutputs}/sipyco-manual-latexpdf-beta/share/doc/sipyco-manual/SiPyCo.pdf"; + }; locations."/artiq/manual-beta/" = { alias = "${hydraWwwOutputs}/artiq-manual-html-beta/share/doc/artiq-manual/html/"; };