My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nomicon/pkgs/applications/science/math/sage/sage.nix

62 lines
1.7 KiB

{ lib, stdenv
, makeWrapper
6 years ago
, sage-tests
, sage-with-env
, jupyter-kernel-specs
6 years ago
, sagedoc
, withDoc
, requireSageTests
}:
# A wrapper that makes sure sage finds its docs (if they were build) and the
# jupyter kernel spec.
6 years ago
stdenv.mkDerivation rec {
6 years ago
version = src.version;
pname = "sage";
6 years ago
src = sage-with-env.env.lib.src;
buildInputs = [
makeWrapper
] ++ lib.optionals requireSageTests [
6 years ago
# This is a hack to make sure sage-tests is evaluated. It doesn't acutally
# produce anything of value, it just decouples the tests from the build.
sage-tests
];
dontUnpack = true;
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
mkdir -p "$out/bin"
6 years ago
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
} \
--prefix JUPYTER_PATH : "${jupyter-kernel-specs}"
'';
6 years ago
doInstallCheck = withDoc;
installCheckPhase = ''
export HOME="$TMPDIR/sage-home"
mkdir -p "$HOME"
6 years ago
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
'';
6 years ago
passthru = {
tests = sage-tests;
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
6 years ago
doc = sagedoc;
lib = sage-with-env.env.lib;
kernelspec = jupyter-kernel-specs.definition.sagemath;
6 years ago
};
meta = with lib; {
6 years ago
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
3 years ago
homepage = "https://www.sagemath.org";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
6 years ago
};
}