mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 08:43:06 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
197 lines
4.5 KiB
Nix
197 lines
4.5 KiB
Nix
{ stdenv
|
|
, lib
|
|
, writeTextFile
|
|
, sagelib
|
|
, sage-docbuild
|
|
, env-locations
|
|
, gfortran
|
|
, ninja
|
|
, bash
|
|
, coreutils
|
|
, gnused
|
|
, gnugrep
|
|
, gawk
|
|
, binutils
|
|
, pythonEnv
|
|
, python3
|
|
, pkg-config
|
|
, pari
|
|
, gap
|
|
, maxima
|
|
, singular
|
|
, fflas-ffpack
|
|
, givaro
|
|
, gd
|
|
, libpng
|
|
, linbox
|
|
, m4ri
|
|
, giac
|
|
, palp
|
|
, rWrapper
|
|
, gfan
|
|
, cddlib
|
|
, jmol
|
|
, tachyon
|
|
, glpk
|
|
, eclib
|
|
, sympow
|
|
, nauty
|
|
, sqlite
|
|
, ppl
|
|
, ecm
|
|
, lcalc
|
|
, rubiks
|
|
, blas
|
|
, lapack
|
|
, flint3
|
|
, gmp
|
|
, mpfr
|
|
, zlib
|
|
, gsl
|
|
, ntl
|
|
, jre8
|
|
, less
|
|
}:
|
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
|
|
|
# This generates a `sage-env` shell file that will be sourced by sage on startup.
|
|
# It sets up various environment variables, telling sage where to find its
|
|
# dependencies.
|
|
|
|
let
|
|
runtimepath = (lib.makeBinPath ([
|
|
"@sage-local@"
|
|
"@sage-local@/build"
|
|
pythonEnv
|
|
gfortran # for inline fortran
|
|
ninja # for inline fortran via numpy.f2py
|
|
stdenv.cc # for cython
|
|
bash
|
|
coreutils
|
|
gnused
|
|
gnugrep
|
|
gawk
|
|
binutils.bintools
|
|
pkg-config
|
|
pari
|
|
gap
|
|
maxima.lisp-compiler
|
|
maxima
|
|
singular
|
|
giac
|
|
palp
|
|
# needs to be rWrapper since the default `R` doesn't include R's default libraries
|
|
rWrapper
|
|
gfan
|
|
cddlib
|
|
jmol
|
|
tachyon
|
|
glpk
|
|
eclib
|
|
sympow
|
|
nauty
|
|
sqlite
|
|
ppl
|
|
ecm
|
|
lcalc
|
|
rubiks
|
|
jre8 # only needed for `jmol` (https://sourceforge.net/p/jmol/mailman/message/58818762/), which will be optional in sage 10.5
|
|
less # needed to prevent transient test errors until https://github.com/ipython/ipython/pull/11864 is resolved
|
|
]
|
|
));
|
|
in
|
|
writeTextFile rec {
|
|
name = "sage-env";
|
|
destination = "/${name}";
|
|
text = ''
|
|
export PKG_CONFIG_PATH='${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
|
|
# This should only be needed during build. However, since the doctests
|
|
# also test the cython build (for example in src/sage/misc/cython.py),
|
|
# it is also needed for the testsuite to pass. We could fix the
|
|
# testsuite instead, but since all the packages are also runtime
|
|
# dependencies it doesn't really hurt to include them here.
|
|
singular
|
|
blas lapack
|
|
fflas-ffpack givaro
|
|
gd
|
|
libpng zlib
|
|
gsl
|
|
linbox
|
|
m4ri
|
|
]
|
|
}'
|
|
export SAGE_ROOT='${sagelib.src}'
|
|
'' +
|
|
# 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}'
|
|
|
|
# set dependent vars, like JUPYTER_CONFIG_DIR
|
|
source "${sagelib.src}/src/bin/sage-env"
|
|
export PATH="$RUNTIMEPATH_PREFIX:${runtimepath}:$orig_path" # sage-env messes with PATH
|
|
|
|
export SAGE_LOGS="$TMPDIR/sage-logs"
|
|
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
|
|
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}"
|
|
|
|
# set locations of dependencies
|
|
. ${env-locations}/sage-env-locations
|
|
|
|
# needed for cython
|
|
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
|
|
export CXX='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++'
|
|
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
|
|
export LDFLAGS='${
|
|
lib.concatStringsSep " " (map (pkg: "-L${pkg}/lib") [
|
|
flint3
|
|
gap
|
|
glpk
|
|
gmp
|
|
mpfr
|
|
pari
|
|
zlib
|
|
eclib
|
|
gsl
|
|
ntl
|
|
jmol
|
|
sympow
|
|
])
|
|
}'
|
|
export CFLAGS='${
|
|
lib.concatStringsSep " " (map (pkg: "-isystem ${pkg}/include") [
|
|
singular
|
|
gmp.dev
|
|
glpk
|
|
flint3
|
|
gap
|
|
mpfr.dev
|
|
])
|
|
}'
|
|
export CXXFLAGS=$CFLAGS
|
|
|
|
export SAGE_LIB='${sagelib}/${python3.sitePackages}'
|
|
|
|
export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
|
|
|
|
# for find_library
|
|
export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular giac gap]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
|
|
'';
|
|
} // { # equivalent of `passthru`, which `writeTextFile` doesn't support
|
|
lib = sagelib;
|
|
docbuild = sage-docbuild;
|
|
}
|