summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/sage.nix
blob: ad9a32e0ca56d9334bb584cce7b96aec612115c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{ stdenv
, sage-with-env
, makeWrapper
}:

stdenv.mkDerivation rec {
  version = sage-with-env.version;
  name = "sage-tests-${version}";

  buildInputs = [
    makeWrapper
  ];

  unpackPhase = "#do nothing";
  configurePhase = "#do nothing";
  buildPhase = "#do nothing";

  installPhase = ''
    mkdir -p "$out/bin"
    # Like a symlink, but make sure that $0 points to the original.
    makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage"
  '';

  doInstallCheck = true;
  installCheckPhase = ''
    export HOME="$TMPDIR/sage-home"
    mkdir -p "$HOME"

    # "--long" tests are in the order of 1h, without "--long" its 1/2h
    "$out/bin/sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage --long --all
  '';
}