sageWithDoc: make jupyter-sphinx available for docbuild

+21 -16
+8 -2
pkgs/applications/science/math/sage/default.nix
··· 48 48 logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png"; 49 49 }; 50 50 51 + jupyter-kernel-specs = pkgs.jupyter-kernel.create { 52 + definitions = pkgs.jupyter-kernel.default // { 53 + sagemath = jupyter-kernel-definition; 54 + }; 55 + }; 56 + 51 57 three = callPackage ./threejs-sage.nix { }; 52 58 53 59 # A bash script setting various environment variables to tell sage where ··· 73 79 # The documentation for sage, building it takes a lot of ram. 74 80 sagedoc = callPackage ./sagedoc.nix { 75 81 inherit sage-with-env; 76 - inherit python3 maxima; 82 + inherit python3 maxima jupyter-kernel-specs; 77 83 }; 78 84 79 85 # sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run. ··· 167 173 in 168 174 # A wrapper around sage that makes sure sage finds its docs (if they were build). 169 175 callPackage ./sage.nix { 170 - inherit sage-tests sage-with-env sagedoc jupyter-kernel-definition; 176 + inherit sage-tests sage-with-env sagedoc jupyter-kernel-specs; 171 177 inherit withDoc requireSageTests; 172 178 }
+2
pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix
··· 2 2 , buildPythonPackage 3 3 , sage-src 4 4 , sphinx 5 + , jupyter-sphinx 5 6 }: 6 7 7 8 buildPythonPackage rec { ··· 11 12 12 13 propagatedBuildInputs = [ 13 14 sphinx 15 + jupyter-sphinx 14 16 ]; 15 17 16 18 preBuild = ''
+3 -12
pkgs/applications/science/math/sage/sage.nix
··· 2 2 , makeWrapper 3 3 , sage-tests 4 4 , sage-with-env 5 - , jupyter-kernel-definition 6 - , jupyter-kernel 5 + , jupyter-kernel-specs 7 6 , sagedoc 8 7 , withDoc 9 8 , requireSageTests ··· 12 11 # A wrapper that makes sure sage finds its docs (if they were build) and the 13 12 # jupyter kernel spec. 14 13 15 - let 16 - # generate kernel spec + default kernels 17 - kernel-specs = jupyter-kernel.create { 18 - definitions = jupyter-kernel.default // { 19 - sagemath = jupyter-kernel-definition; 20 - }; 21 - }; 22 - in 23 14 stdenv.mkDerivation rec { 24 15 version = src.version; 25 16 pname = "sage"; ··· 43 34 --set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${ 44 35 lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage" 45 36 } \ 46 - --prefix JUPYTER_PATH : "${kernel-specs}" 37 + --prefix JUPYTER_PATH : "${jupyter-kernel-specs}" 47 38 ''; 48 39 49 40 doInstallCheck = withDoc; ··· 58 49 quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m 59 50 doc = sagedoc; 60 51 lib = sage-with-env.env.lib; 61 - kernelspec = jupyter-kernel-definition; 52 + kernelspec = jupyter-kernel-specs.definition.sagemath; 62 53 }; 63 54 64 55 meta = with lib; {
+8 -2
pkgs/applications/science/math/sage/sagedoc.nix
··· 1 1 { stdenv 2 2 , sage-with-env 3 3 , python3 4 + , jupyter-kernel-specs 4 5 , maxima 5 6 , tachyon 6 7 , jmol ··· 59 60 OUTPUT="$OUTPUT_DIR/options.txt" 60 61 ${sage-with-env}/bin/sage -advanced > "$OUTPUT" 61 62 62 - ${sage-with-env}/bin/sage --docbuild \ 63 + # jupyter-sphinx calls the sagemath jupyter kernel during docbuild 64 + export JUPYTER_PATH=${jupyter-kernel-specs} 65 + 66 + # sage --docbuild unsets JUPYTER_PATH, so we call sage_docbuild directly 67 + # https://trac.sagemath.org/ticket/33650#comment:32 68 + ${sage-with-env}/bin/sage --python3 -m sage_docbuild \ 63 69 --mathjax \ 64 70 --no-pdf-links \ 65 - all html 71 + all html < /dev/null 66 72 ''; 67 73 68 74 installPhase = ''