summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/sage.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math/sage/sage.nix')
-rw-r--r--pkgs/applications/science/math/sage/sage.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix
new file mode 100644
index 000000000000..b1e5d7278b0f
--- /dev/null
+++ b/pkgs/applications/science/math/sage/sage.nix
@@ -0,0 +1,32 @@
+{ stdenv
+, sage-with-env
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+  version = sage-with-env.version;
+  name = "sage-${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
+  '';
+}