sage: refactor

+212 -191
+1 -40
pkgs/applications/science/math/sage/README.md
··· 2 2 3 3 Sage is a pretty complex package that depends on many other complex packages and patches some of those. As a result, the sage nix package is also quite complex. 4 4 5 - Don't feel discouraged to fix, simplify or improve things though. Here's a quick overview over the functions of the individual files: 6 - 7 - - `sage-src.nix` 8 - Downloads the source code and applies patches. This makes sure that all the other files work with the same sage source. If you want to apply a patch to sage or update sage to a new version, this is the place to do it. 9 - 10 - - `env-locations.nix` 11 - Creates a bash file that sets a bunch of environment variables telling sage where to find various packages and files. The definitions of those environment variables can be found in the sage source in the `src/env.py` file. This bash file needs to be sourced before sage is started (done in `sage-env.nix` and `sagedoc.nix`). 12 - 13 - - `sage-env.nix` 14 - Sets all environment variables sage needs to run. This includes the package locations defined in `env-locations.nix` as well as the location of sage itself and its various subdirectories. 15 - 16 - - `sagelib.nix` 17 - Defines the main sage package (without setting the necessary environments or running any tests). 18 - 19 - - `sage-with-env.nix` 20 - Wraps sage in the necessary environment. 21 - 22 - - `sage.nix` 23 - Runs sages doctests. 24 - 25 - - `sage-wrapper.nix` 26 - Optionally tells sage where do find the docs. 27 - 28 - - `sagedoc.nix` 29 - Builds and tests the sage html documentation. Can be used for offline documentation viewing as well as the sage `browse_sage_doc` and `search_doc` functions. 30 - 31 - - `sagenb.nix` 32 - The (semi deprecated) sage notebook. 33 - 34 - - `default.nix` 35 - Introduces necessary overrides, defines new packages and ties everything together (returning the `sage` package). 36 - 37 - - `flask-oldsessions.nix`, `flask-openid.nix`, `python-openid.nix` 38 - These are python packages that were rejected from the main nixpkgs tree because they appear unmaintained. They are needed for the (semi-deprecated) sage notebook. Since that notebook is still needed to run the sage doctests, these packages are included but not exposed to the rest of nixpkgs. 39 - 40 - - `pybrial.nix` 41 - pybrial is a dependency of sage. However, pybrial itself also has sage as a dependency. Because of that circular dependency, pybrial is hidden from the rest of nixpkgs (just as the flask packages and python-openid. 42 - 43 - - `openblas-pc.nix` 44 - This creates a `.pc` file to be read by `pkg-config` that allows openblas to take on different roles, like `cblas` or `lapack`. 5 + Don't feel discouraged to fix, simplify or improve things though. The individual files have comments explaining their purpose. The most importent ones are `default.nix` linking everything together, `sage-src.nix` adding patches and `sagelib.nix` building the actual sage package. 45 6 46 7 ## The sage build is broken 47 8
+73 -50
pkgs/applications/science/math/sage/default.nix
··· 1 - { nixpkgs 1 + { pkgs 2 2 , withDoc ? false 3 3 }: 4 4 5 + # Here sage and its dependencies are put together. Some dependencies may be pinned 6 + # as a last resort. Patching sage for compatibility with newer dependency versions 7 + # is always preferred, see `sage-src.nix` for that. 8 + 5 9 let 6 - inherit (nixpkgs) fetchpatch fetchurl symlinkJoin callPackage nodePackages; 10 + inherit (pkgs) fetchurl symlinkJoin callPackage nodePackages_8_x; 7 11 8 12 # https://trac.sagemath.org/ticket/15980 for tracking of python3 support 9 - python = nixpkgs.python2.override { 13 + python = pkgs.python2.override { 10 14 packageOverrides = self: super: { 11 15 # python packages that appear unmaintained and were not accepted into the nixpkgs 12 16 # tree because of that. These packages are only dependencies of the more-or-less 13 17 # deprecated sagenb. However sagenb is still a default dependency and the doctests 14 18 # depend on it. 15 19 # See https://github.com/NixOS/nixpkgs/pull/38787 for a discussion. 20 + # The dependency on the sage notebook (and therefore these packages) will be 21 + # removed in the future: 22 + # https://trac.sagemath.org/ticket/25837 16 23 flask-oldsessions = self.callPackage ./flask-oldsessions.nix {}; 17 24 flask-openid = self.callPackage ./flask-openid.nix {}; 18 25 python-openid = self.callPackage ./python-openid.nix {}; 26 + sagenb = self.callPackage ./sagenb.nix { 27 + mathjax = nodePackages_8_x.mathjax; 28 + }; 19 29 30 + # Package with a cyclic dependency with sage 20 31 pybrial = self.callPackage ./pybrial.nix {}; 21 32 33 + # `sagelib`, i.e. all of sage except some wrappers and runtime dependencies 22 34 sagelib = self.callPackage ./sagelib.nix { 23 35 inherit flint ecl arb; 24 36 inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular; 25 - linbox = nixpkgs.linbox.override { withSage = true; }; 37 + linbox = pkgs.linbox.override { withSage = true; }; 26 38 }; 39 + }; 40 + }; 27 41 28 - sagenb = self.callPackage ./sagenb.nix { 29 - mathjax = nodePackages.mathjax; 30 - }; 42 + # A bash script setting various environment variables to tell sage where 43 + # the files its looking fore are located. Also see `sage-env`. 44 + env-locations = callPackage ./env-locations.nix { 45 + inherit pari_data ecl; 46 + inherit singular; 47 + cysignals = python.pkgs.cysignals; 48 + three = nodePackages_8_x.three; 49 + mathjax = nodePackages_8_x.mathjax; 50 + }; 31 51 32 - sagedoc = self.callPackage ./sagedoc.nix { 33 - inherit sage-src; 34 - }; 52 + # The shell file that gets sourced on every sage start. Will also source 53 + # the env-locations file. 54 + sage-env = callPackage ./sage-env.nix { 55 + sagelib = python.pkgs.sagelib; 56 + inherit env-locations; 57 + inherit python rWrapper openblas-cblas-pc ecl singular palp flint pynac pythonEnv; 58 + pkg-config = pkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig 59 + }; 35 60 36 - env-locations = self.callPackage ./env-locations.nix { 37 - inherit pari_data ecl; 38 - inherit singular; 39 - three = nodePackages.three; 40 - mathjax = nodePackages.mathjax; 41 - }; 61 + # The documentation for sage, building it takes a lot of ram. 62 + sagedoc = callPackage ./sagedoc.nix { 63 + inherit sage-with-env; 64 + inherit python; 65 + }; 42 66 43 - sage-env = self.callPackage ./sage-env.nix { 44 - inherit sage-src python rWrapper openblas-cblas-pc ecl singular palp flint pynac pythonEnv; 45 - pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig 46 - }; 47 - 48 - sage-with-env = self.callPackage ./sage-with-env.nix { 49 - inherit pythonEnv; 50 - inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular; 51 - pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig 52 - three = nodePackages.three; 53 - }; 54 - 55 - sage = self.callPackage ./sage.nix { }; 67 + # sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run. 68 + sage-with-env = callPackage ./sage-with-env.nix { 69 + inherit pythonEnv; 70 + inherit sage-env; 71 + inherit openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular; 72 + pkg-config = pkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig 73 + three = nodePackages_8_x.three; 74 + }; 56 75 57 - sage-wrapper = self.callPackage ./sage-wrapper.nix { 58 - inherit sage-src withDoc; 59 - }; 60 - }; 76 + # Doesn't actually build anything, just runs sages testsuite. This is a 77 + # separate derivation to make it possible to re-run the tests without 78 + # rebuilding sagelib (which takes ~30 minutes). 79 + # Running the tests should take something in the order of 1h. 80 + sage-tests = callPackage ./sage-tests.nix { 81 + inherit sage-with-env; 61 82 }; 62 83 84 + # FIXME 63 85 openblas-blas-pc = callPackage ./openblas-pc.nix { name = "blas"; }; 64 86 openblas-cblas-pc = callPackage ./openblas-pc.nix { name = "cblas"; }; 65 87 openblas-lapack-pc = callPackage ./openblas-pc.nix { name = "lapack"; }; ··· 91 113 } // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible 92 114 93 115 # needs to be rWrapper, standard "R" doesn't include default packages 94 - rWrapper = nixpkgs.rWrapper.override { 116 + rWrapper = pkgs.rWrapper.override { 95 117 # https://trac.sagemath.org/ticket/25674 96 - R = nixpkgs.R.overrideAttrs (attrs: rec { 118 + R = pkgs.R.overrideAttrs (attrs: rec { 97 119 name = "R-3.4.4"; 98 120 src = fetchurl { 99 121 url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz"; ··· 102 124 }); 103 125 }; 104 126 105 - arb = nixpkgs.arb.override { inherit flint; }; 127 + arb = pkgs.arb.override { inherit flint; }; 106 128 107 - singular = nixpkgs.singular.override { inherit flint; }; 129 + singular = pkgs.singular.override { inherit flint; }; 108 130 109 131 # *not* to confuse with the python package "pynac" 110 - pynac = nixpkgs.pynac.override { inherit singular flint; }; 132 + pynac = pkgs.pynac.override { inherit singular flint; }; 111 133 112 134 # With openblas (64 bit), the tests fail the same way as when sage is build with 113 135 # openblas instead of openblasCompat. Apparently other packages somehow use flints 114 136 # blas when it is available. Alternative would be to override flint to use 115 137 # openblasCompat. 116 - flint = nixpkgs.flint.override { withBlas = false; }; 138 + flint = pkgs.flint.override { withBlas = false; }; 117 139 118 140 # Multiple palp dimensions need to be available and sage expects them all to be 119 141 # in the same folder. 120 142 palp = symlinkJoin { 121 - name = "palp-${nixpkgs.palp.version}"; 143 + name = "palp-${pkgs.palp.version}"; 122 144 paths = [ 123 - (nixpkgs.palp.override { dimensions = 4; doSymlink = false; }) 124 - (nixpkgs.palp.override { dimensions = 5; doSymlink = false; }) 125 - (nixpkgs.palp.override { dimensions = 6; doSymlink = true; }) 126 - (nixpkgs.palp.override { dimensions = 11; doSymlink = false; }) 145 + (pkgs.palp.override { dimensions = 4; doSymlink = false; }) 146 + (pkgs.palp.override { dimensions = 5; doSymlink = false; }) 147 + (pkgs.palp.override { dimensions = 6; doSymlink = true; }) 148 + (pkgs.palp.override { dimensions = 11; doSymlink = false; }) 127 149 ]; 128 150 }; 129 151 130 152 # Sage expects those in the same directory. 131 153 pari_data = symlinkJoin { 132 154 name = "pari_data"; 133 - paths = with nixpkgs; [ 155 + paths = with pkgs; [ 134 156 pari-galdata 135 157 pari-seadata-small 136 158 ]; 137 159 }; 138 160 139 161 # https://trac.sagemath.org/ticket/22191 140 - ecl = nixpkgs.ecl_16_1_2; 162 + ecl = pkgs.ecl_16_1_2; 141 163 in 142 - python.pkgs.sage-wrapper // { 143 - doc = python.pkgs.sagedoc; 144 - lib = python.pkgs.sagelib; 145 - } 164 + # A wrapper around sage that makes sure sage finds its docs (if they were build). 165 + callPackage ./sage.nix { 166 + inherit sage-tests sage-with-env sagedoc; 167 + inherit withDoc; 168 + }
+2
pkgs/applications/science/math/sage/env-locations.nix
··· 16 16 , cysignals 17 17 }: 18 18 19 + # A bash script setting various environment variables to tell sage where 20 + # the files its looking fore are located. Also see `sage-env`. 19 21 writeTextFile rec { 20 22 name = "sage-env-locations"; 21 23 destination = "/${name}";
+11 -6
pkgs/applications/science/math/sage/sage-env.nix
··· 2 2 , lib 3 3 , writeTextFile 4 4 , python 5 - , sage-src 6 5 , sagelib 7 6 , env-locations 8 7 , gfortran ··· 46 45 , gsl 47 46 , ntl 48 47 }: 48 + 49 + # This generates a `sage-env` shell file that will be sourced by sage on startup. 50 + # It sets up various environment variables, telling sage where to find its 51 + # dependencies. 49 52 50 53 let 51 54 runtimepath = (lib.makeBinPath ([ ··· 103 106 openblas-cblas-pc 104 107 ]) 105 108 }' 106 - export SAGE_ROOT='${sage-src}' 109 + export SAGE_ROOT='${sagelib.src}' 107 110 export SAGE_LOCAL='@sage-local@' 108 111 export SAGE_SHARE='${sagelib}/share' 109 112 orig_path="$PATH" 110 113 export PATH='${runtimepath}' 111 114 112 115 # set dependent vars, like JUPYTER_CONFIG_DIR 113 - source "${sage-src}/src/bin/sage-env" 116 + source "${sagelib.src}/src/bin/sage-env" 114 117 export PATH="${runtimepath}:$orig_path" # sage-env messes with PATH 115 118 116 119 export SAGE_LOGS="$TMPDIR/sage-logs" 117 120 export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}" 118 - export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sage-src}/src/doc}" 121 + export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}" 119 122 120 123 # set locations of dependencies 121 124 . ${env-locations}/sage-env-locations ··· 154 157 155 158 export SAGE_LIB='${sagelib}/${python.sitePackages}' 156 159 157 - export SAGE_EXTCODE='${sage-src}/src/ext' 160 + export SAGE_EXTCODE='${sagelib.src}/src/ext' 158 161 159 - # for find_library 162 + # for find_library 160 163 export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}:$DYLD_LIBRARY_PATH" 161 164 ''; 165 + } // { 166 + lib = sagelib; # equivalent of `passthru`, which `writeTextFile` doesn't support 162 167 }
+19 -5
pkgs/applications/science/math/sage/sage-src.nix
··· 2 2 , fetchFromGitHub 3 3 , fetchpatch 4 4 }: 5 + 6 + # This file is responsible for fetching the sage source and adding necessary patches. 7 + # It does not actually build anything, it just copies the patched sources to $out. 8 + # This is done because multiple derivations rely on these sources and they should 9 + # all get the same sources with the same patches applied. 10 + 5 11 stdenv.mkDerivation rec { 6 12 version = "8.4"; 7 13 name = "sage-src-${version}"; ··· 13 19 sha256 = "0gips1hagiz9m7s21bg5as8hrrm2x5k47h1bsq0pc46iplfwmv2d"; 14 20 }; 15 21 22 + # Patches needed because of particularities of nix or the way this is packaged. 23 + # The goal is to upstream all of them and get rid of this list. 16 24 nixPatches = [ 17 25 # https://trac.sagemath.org/ticket/25358 18 26 (fetchpatch { ··· 40 48 ./patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch 41 49 ]; 42 50 51 + # Patches needed because of package updates. We could just pin the versions of 52 + # dependencies, but that would lead to rebuilds, confusion and the burdons of 53 + # maintaining multiple versions of dependencies. Instead we try to make sage 54 + # compatible with never dependency versions when possible. All these changes 55 + # should come from or be proposed to upstream. This list will probably never 56 + # be empty since dependencies update all the time. 43 57 packageUpgradePatches = let 44 - # fetch a diff between base and rev on sage's git server 45 - # used to fetch trac tickets by setting the base to the release and the 46 - # revision to the last commit that should be included 58 + # Fetch a diff between `base` and `rev` on sage's git server. 59 + # Used to fetch trac tickets by setting the `base` to the last release and the 60 + # `rev` to the last commit of the ticket. 47 61 fetchSageDiff = { base, rev, ...}@args: ( 48 62 fetchpatch ({ 49 63 url = "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}"; ··· 65 79 # https://trac.sagemath.org/ticket/25260 66 80 ./patches/numpy-1.15.1.patch 67 81 68 - # ntl upgrade 69 - # https://trac.sagemath.org/ticket/25532#comment:29 82 + # needed for ntl update 83 + # https://trac.sagemath.org/ticket/25532 70 84 (fetchpatch { 71 85 name = "lcalc-c++11.patch"; 72 86 url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/sagemath-lcalc-c++11.patch?h=packages/sagemath&id=0e31ae526ab7c6b5c0bfacb3f8b1c4fd490035aa";
+36
pkgs/applications/science/math/sage/sage-tests.nix
··· 1 + { stdenv 2 + , sage-with-env 3 + , makeWrapper 4 + }: 5 + 6 + stdenv.mkDerivation rec { 7 + version = src.version; 8 + name = "sage-tests-${version}"; 9 + src = sage-with-env.env.lib.src; 10 + 11 + buildInputs = [ 12 + makeWrapper 13 + ]; 14 + 15 + unpackPhase = "#do nothing"; 16 + configurePhase = "#do nothing"; 17 + buildPhase = "#do nothing"; 18 + 19 + installPhase = '' 20 + # This output is not actually needed for anything, the package just 21 + # exists to decouple the sage build from its t ests. 22 + 23 + mkdir -p "$out/bin" 24 + # Like a symlink, but make sure that $0 points to the original. 25 + makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" 26 + ''; 27 + 28 + doInstallCheck = true; 29 + installCheckPhase = '' 30 + export HOME="$TMPDIR/sage-home" 31 + mkdir -p "$HOME" 32 + 33 + # "--long" tests are in the order of 1h, without "--long" its 1/2h 34 + "$out/bin/sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage --long --all 35 + ''; 36 + }
+13 -5
pkgs/applications/science/math/sage/sage-with-env.nix
··· 2 2 , lib 3 3 , makeWrapper 4 4 , sage-env 5 - , sage-src 6 5 , openblasCompat 7 6 , openblas-blas-pc 8 7 , openblas-cblas-pc ··· 25 24 , pynac 26 25 , pythonEnv 27 26 }: 27 + 28 + # Wrapper that combined `sagelib` with `sage-env` to produce an actually 29 + # executable sage. No tests are run yet and no documentation is built. 28 30 29 31 let 30 32 buildInputs = [ ··· 92 94 input_names = map (dep: pkg_to_spkg_name dep patch_names) transitiveDeps; 93 95 in 94 96 stdenv.mkDerivation rec { 95 - version = sage-src.version; 97 + version = src.version; 96 98 name = "sage-with-env-${version}"; 99 + src = sage-env.lib.src; 97 100 98 101 inherit buildInputs; 99 - 100 - src = sage-src; 101 102 102 103 configurePhase = "#do nothing"; 103 104 ··· 110 111 111 112 installPhase = '' 112 113 mkdir -p "$out/var/lib/sage" 113 - cp -r installed $out/var/lib/sage 114 + cp -r installed "$out/var/lib/sage" 114 115 115 116 mkdir -p "$out/etc" 116 117 # sage tests will try to create this file if it doesn't exist 117 118 touch "$out/etc/sage-started.txt" 118 119 119 120 mkdir -p "$out/build" 121 + 122 + # the scripts in src/bin will find the actual sage source files using environment variables set in `sage-env` 120 123 cp -r src/bin "$out/bin" 121 124 cp -r build/bin "$out/build/bin" 125 + 122 126 cp -f '${sage-env}/sage-env' "$out/bin/sage-env" 123 127 substituteInPlace "$out/bin/sage-env" \ 124 128 --subst-var-by sage-local "$out" 125 129 ''; 130 + 131 + passthru = { 132 + env = sage-env; 133 + }; 126 134 }
-41
pkgs/applications/science/math/sage/sage-wrapper.nix
··· 1 - { stdenv 2 - , makeWrapper 3 - , sage 4 - , sage-src 5 - , sagedoc 6 - , withDoc 7 - }: 8 - 9 - stdenv.mkDerivation rec { 10 - version = sage.version; 11 - name = "sage-${version}"; 12 - 13 - buildInputs = [ 14 - makeWrapper 15 - ]; 16 - 17 - unpackPhase = "#do nothing"; 18 - configurePhase = "#do nothing"; 19 - buildPhase = "#do nothing"; 20 - 21 - installPhase = '' 22 - mkdir -p "$out/bin" 23 - makeWrapper "${sage}/bin/sage" "$out/bin/sage" \ 24 - --set SAGE_DOC_SRC_OVERRIDE "${sage-src}/src/doc" ${ 25 - stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage" 26 - } 27 - ''; 28 - 29 - doInstallCheck = withDoc; 30 - installCheckPhase = '' 31 - export HOME="$TMPDIR/sage-home" 32 - mkdir -p "$HOME" 33 - "$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)' 34 - ''; 35 - 36 - meta = with stdenv.lib; { 37 - description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"; 38 - license = licenses.gpl2; 39 - maintainers = with maintainers; [ timokau ]; 40 - }; 41 - }
+31 -9
pkgs/applications/science/math/sage/sage.nix
··· 1 1 { stdenv 2 + , makeWrapper 3 + , sage-tests 2 4 , sage-with-env 3 - , makeWrapper 5 + , sagedoc 6 + , withDoc 4 7 }: 5 8 9 + # A wrapper that makes sure sage finds its docs (if they were build). 10 + 6 11 stdenv.mkDerivation rec { 7 - version = sage-with-env.version; 8 - name = "sage-tests-${version}"; 12 + version = src.version; 13 + name = "sage-${version}"; 14 + src = sage-with-env.env.lib.src; 9 15 10 16 buildInputs = [ 11 17 makeWrapper 18 + 19 + # This is a hack to make sure sage-tests is evaluated. It doesn't acutally 20 + # produce anything of value, it just decouples the tests from the build. 21 + sage-tests 12 22 ]; 13 23 14 24 unpackPhase = "#do nothing"; ··· 17 27 18 28 installPhase = '' 19 29 mkdir -p "$out/bin" 20 - # Like a symlink, but make sure that $0 points to the original. 21 - makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" 30 + makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \ 31 + --set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${ 32 + stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage" 33 + } 22 34 ''; 23 35 24 - doInstallCheck = true; 36 + doInstallCheck = withDoc; 25 37 installCheckPhase = '' 26 38 export HOME="$TMPDIR/sage-home" 27 39 mkdir -p "$HOME" 28 - 29 - # "--long" tests are in the order of 1h, without "--long" its 1/2h 30 - "$out/bin/sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage --long --all 40 + "$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)' 31 41 ''; 42 + 43 + passthru = { 44 + tests = sage-tests; 45 + doc = sagedoc; 46 + lib = sage-with-env.env.lib; 47 + }; 48 + 49 + meta = with stdenv.lib; { 50 + description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"; 51 + license = licenses.gpl2; 52 + maintainers = with maintainers; [ timokau ]; 53 + }; 32 54 }
+14 -28
pkgs/applications/science/math/sage/sagedoc.nix
··· 1 1 { stdenv 2 - , sage-src 3 2 , sage-with-env 4 - , sagelib 5 - , python2 6 - , psutil 7 - , future 8 - , sphinx 9 - , sagenb 3 + , python 10 4 , maxima-ecl 11 - , networkx 12 - , scipy 13 - , sympy 14 - , matplotlib 15 - , pillow 16 - , ipykernel 17 - , jupyter_client 18 5 , tachyon 19 6 , jmol 20 - , ipywidgets 21 - , typing 22 7 , cddlib 23 - , pybrial 24 8 }: 25 9 26 10 stdenv.mkDerivation rec { 27 - version = sage-src.version; 11 + version = src.version; 28 12 name = "sagedoc-${version}"; 13 + src = sage-with-env.env.lib.src; 29 14 30 15 31 16 # Building the documentation has many dependencies, because all documented 32 17 # modules are imported and because matplotlib is used to produce plots. 33 18 buildInputs = [ 34 - sagelib 35 - python2 19 + sage-with-env.env.lib 20 + python 21 + maxima-ecl 22 + tachyon 23 + jmol 24 + cddlib 25 + ] ++ (with python.pkgs; [ 36 26 psutil 37 27 future 38 28 sphinx 39 29 sagenb 40 - maxima-ecl 41 - networkx 42 30 scipy 43 31 sympy 44 32 matplotlib 45 33 pillow 34 + networkx 46 35 ipykernel 36 + ipywidgets 47 37 jupyter_client 48 - tachyon 49 - jmol 50 - ipywidgets 51 38 typing 52 - cddlib 53 39 pybrial 54 - ]; 40 + ]); 55 41 56 42 unpackPhase = '' 57 43 export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage" 58 44 export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc" 59 45 60 - cp -r "${sage-src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE" 46 + cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE" 61 47 chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE" 62 48 ''; 63 49
+7 -3
pkgs/applications/science/math/sage/sagelib.nix
··· 51 51 , libbraiding 52 52 }: 53 53 54 + # This is the core sage python package. Everything else is just wrappers gluing 55 + # stuff together. It is not very useful on its own though, since it will not 56 + # find many of its dependencies without `sage-env`, will not be tested without 57 + # `sage-tests` and will not have html docs without `sagedoc`. 58 + 54 59 buildPythonPackage rec { 55 60 format = "other"; 56 - version = sage-src.version; 57 - pname = "sagelib"; 58 - 61 + version = src.version; 62 + name = "sagelib-${version}"; 59 63 src = sage-src; 60 64 61 65 nativeBuildInputs = [
+4 -1
pkgs/applications/science/math/sage/sagenb.nix
··· 1 - # Has a cyclic dependency with sage (not expressed here) and is not useful outside of sage 2 1 { stdenv 3 2 , fetchpatch 4 3 , python ··· 12 11 , flask-autoindex 13 12 , flask-babel 14 13 }: 14 + 15 + # Has a cyclic dependency with sage (not expressed here) and is not useful outside of sage. 16 + # Deprecated, hopefully soon to be removed. See 17 + # https://trac.sagemath.org/ticket/25837 15 18 16 19 buildPythonPackage rec { 17 20 pname = "sagenb";
+1 -3
pkgs/top-level/all-packages.nix
··· 21358 21358 21359 21359 scs = callPackage ../development/libraries/science/math/scs { }; 21360 21360 21361 - sage = callPackage ../applications/science/math/sage { 21362 - nixpkgs = pkgs; 21363 - }; 21361 + sage = callPackage ../applications/science/math/sage { }; 21364 21362 sageWithDoc = sage.override { withDoc = true; }; 21365 21363 21366 21364 suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };