about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/sage/sage-env.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/math/sage/sage-env.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/sage-env.nix25
1 files changed, 16 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/applications/science/math/sage/sage-env.nix b/nixpkgs/pkgs/applications/science/math/sage/sage-env.nix
index ba7f6ccd18b5..568a4a39f393 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/sage-env.nix
+++ b/nixpkgs/pkgs/applications/science/math/sage/sage-env.nix
@@ -1,7 +1,6 @@
 { stdenv
 , lib
 , writeTextFile
-, python
 , sagelib
 , env-locations
 , gfortran
@@ -67,11 +66,6 @@ let
     "@sage-local@"
     "@sage-local@/build"
     pythonEnv
-    # empty python env to add python wrapper that clears PYTHONHOME (see
-    # wrapper.nix). This is necessary because sage will call the python3 binary
-    # (from python2 code). The python2 PYTHONHOME (again set in wrapper.nix)
-    # will then confuse python3, if it is not overwritten.
-    python3.buildEnv
     gfortran # for inline fortran
     stdenv.cc # for cython
     bash
@@ -129,8 +123,21 @@ writeTextFile rec {
       ]
     }'
     export SAGE_ROOT='${sagelib.src}'
-    export SAGE_LOCAL='@sage-local@'
+  '' +
+    # TODO: is using pythonEnv instead of @sage-local@ here a good
+    # idea? there is a test in src/sage/env.py that checks if the values
+    # SAGE_ROOT and SAGE_LOCAL set here match the ones set in env.py.
+    # we fix up env.py's SAGE_ROOT in sage-src.nix (which does not
+    # have access to sage-with-env), but env.py autodetects
+    # SAGE_LOCAL to be pythonEnv.
+    # setting SAGE_LOCAL to pythonEnv also avoids having to create
+    # python3, ipython, ipython3 and jupyter symlinks in
+    # sage-with-env.nix.
+  ''
+    export SAGE_LOCAL='${pythonEnv}'
+
     export SAGE_SHARE='${sagelib}/share'
+    export SAGE_ENV_CONFIG_SOURCED=1 # sage-env complains if sage-env-config is not sourced beforehand
     orig_path="$PATH"
     export PATH='${runtimepath}'
 
@@ -177,9 +184,9 @@ writeTextFile rec {
       ])
     }'
 
-    export SAGE_LIB='${sagelib}/${python.sitePackages}'
+    export SAGE_LIB='${sagelib}/${python3.sitePackages}'
 
-    export SAGE_EXTCODE='${sagelib.src}/src/ext'
+    export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
 
   # for find_library
     export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"