nixpkgs/pkgs/applications/science/math/sage/sage-wrapper.nix
2018-06-30 01:21:31 +02:00

42 lines
968 B
Nix

{ stdenv
, makeWrapper
, sage
, sage-src
, sagedoc
, withDoc
}:
stdenv.mkDerivation rec {
version = sage.version;
name = "sage-wrapper-${version}";
buildInputs = [
makeWrapper
];
unpackPhase = "#do nothing";
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
mkdir -p "$out/bin"
makeWrapper "${sage}/bin/sage" "$out/bin/sage" \
--set SAGE_DOC_SRC_OVERRIDE "${sage-src}/src/doc" ${
stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
}
'';
doInstallCheck = withDoc;
installCheckPhase = ''
export HOME="$TMPDIR/sage-home"
mkdir -p "$HOME"
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
'';
meta = with stdenv.lib; {
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
license = licenses.gpl2;
maintainers = with maintainers; [ timokau ];
};
}