2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeWrapper
|
|
|
|
, sage-tests
|
|
|
|
, sage-with-env
|
2022-05-18 14:49:53 +00:00
|
|
|
, jupyter-kernel-specs
|
2020-04-24 23:36:52 +00:00
|
|
|
, sagedoc
|
|
|
|
, withDoc
|
2022-03-05 16:20:37 +00:00
|
|
|
, requireSageTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# A wrapper that makes sure sage finds its docs (if they were build) and the
|
|
|
|
# jupyter kernel spec.
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = src.version;
|
|
|
|
pname = "sage";
|
|
|
|
src = sage-with-env.env.lib.src;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
makeWrapper
|
2022-03-05 16:20:37 +00:00
|
|
|
] ++ lib.optionals requireSageTests [
|
2020-04-24 23:36:52 +00:00
|
|
|
# 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"
|
|
|
|
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
|
|
|
|
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
|
2021-01-17 00:15:33 +00:00
|
|
|
lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
|
2020-04-24 23:36:52 +00:00
|
|
|
} \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix JUPYTER_PATH : "${jupyter-kernel-specs}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = withDoc;
|
|
|
|
installCheckPhase = ''
|
|
|
|
export HOME="$TMPDIR/sage-home"
|
|
|
|
mkdir -p "$HOME"
|
|
|
|
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests = sage-tests;
|
|
|
|
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
|
|
|
|
doc = sagedoc;
|
|
|
|
lib = sage-with-env.env.lib;
|
2022-05-18 14:49:53 +00:00
|
|
|
kernelspec = jupyter-kernel-specs.definition.sagemath;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
|
2022-02-10 20:34:41 +00:00
|
|
|
homepage = "https://www.sagemath.org";
|
|
|
|
license = licenses.gpl2Plus;
|
2020-11-21 19:51:51 +00:00
|
|
|
maintainers = teams.sage.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|