summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/sagedoc.nix
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2018-04-24 23:53:36 +0200
committerTimo Kaufmann <timokau@zoho.com>2018-06-30 01:21:31 +0200
commit17e6b391eb6b524331bce29c01467dc055c8543b (patch)
tree7571e12466aa757abc5c27ca4486f8c39ee89d93 /pkgs/applications/science/math/sage/sagedoc.nix
parent84d89a1ec600de59447ed2a914ce167f51c21089 (diff)
downloadnixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar.gz
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar.bz2
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar.lz
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar.xz
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.tar.zst
nixpkgs-17e6b391eb6b524331bce29c01467dc055c8543b.zip
sage: 8.1 -> 8.2, use system packages
Diffstat (limited to 'pkgs/applications/science/math/sage/sagedoc.nix')
-rw-r--r--pkgs/applications/science/math/sage/sagedoc.nix97
1 files changed, 97 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/sagedoc.nix b/pkgs/applications/science/math/sage/sagedoc.nix
new file mode 100644
index 00000000000..7b280e9e028
--- /dev/null
+++ b/pkgs/applications/science/math/sage/sagedoc.nix
@@ -0,0 +1,97 @@
+{ pkgs
+, stdenv
+, sage-src
+, env-locations
+, sage-with-env
+, sagelib
+, python2
+, psutil
+, future
+, sphinx
+, sagenb
+, maxima-ecl
+, networkx
+, scipy
+, sympy
+, matplotlib
+, pillow
+, ipykernel
+, jupyter_client
+, tachyon
+, jmol
+, ipywidgets
+, typing
+, cddlib
+, pybrial
+}:
+
+stdenv.mkDerivation rec {
+  version = sage-src.version;
+  name = "sagedoc-${version}";
+
+
+  # Building the documentation has many dependencies, because all documented
+  # modules are imported and because matplotlib is used to produce plots.
+  buildInputs = [
+    sagelib
+    python2
+    psutil
+    future
+    sphinx
+    sagenb
+    maxima-ecl
+    networkx
+    scipy
+    sympy
+    matplotlib
+    pillow
+    ipykernel
+    jupyter_client
+    tachyon
+    jmol
+    ipywidgets
+    typing
+    cddlib
+    pybrial
+  ];
+
+  unpackPhase = ''
+    export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
+    export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
+
+    cp -r "${sage-src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
+    chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
+  '';
+
+  buildPhase = ''
+    export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
+    export HOME="$TMPDIR/sage_home"
+    mkdir -p "$HOME"
+
+    ${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
+      --mathjax \
+      --no-pdf-links \
+      all html
+  '';
+
+  installPhase = ''
+    cd "$SAGE_DOC_OVERRIDE"
+
+    mkdir -p "$out/share/doc/sage"
+    cp -r html "$out"/share/doc/sage
+
+    # Replace duplicated files by symlinks (Gentoo)
+    cd "$out"/share/doc/sage
+    mv html/en/_static{,.tmp}
+    for _dir in `find -name _static` ; do
+          rm -r $_dir
+          ln -s /share/doc/sage/html/en/_static $_dir
+    done
+    mv html/en/_static{.tmp,}
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    ${sage-with-env}/bin/sage -t --optional=dochtml --all
+  '';
+}