uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,38 @@
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, glpk
, gmp
}:
stdenv.mkDerivation rec{
pname = "4ti2";
version = "1.6.9";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "Release_${builtins.replaceStrings ["."] ["_"] version}";
hash = "sha256-cywneIM0sHt1iQsNfjyQDoDfdRjxpz4l3rfysi9YN20=";
};
nativeBuildInputs = [
autoreconfHook
];
buildInputs = [
glpk
gmp
];
installFlags = [ "install-exec" ];
meta = with lib;{
homepage = "https://4ti2.github.io/";
description = "A software package for algebraic, geometric and combinatorial problems on linear spaces";
license = with licenses; [ gpl2Plus ];
maintainers = with maintainers; [ AndersonTorres ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,47 @@
{ lib, stdenv, fetchurl
, bison, readline }:
stdenv.mkDerivation {
version = "2.2.2";
# The current version of LiE is 2.2.2, which is more or less unchanged
# since about the year 2000. Minor bugfixes do get applied now and then.
pname = "lie";
meta = {
description = "A Computer algebra package for Lie group computations";
homepage = "http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/";
license = lib.licenses.lgpl3; # see the website
longDescription = ''
LiE is a computer algebra system that is specialised in computations
involving (reductive) Lie groups and their representations. It is
publically available for free in source code. For a description of its
characteristics, we refer to the following sources of information.
''; # take from the website
platforms = lib.platforms.linux;
maintainers = [ ]; # this package is probably not going to change anyway
};
src = fetchurl {
url = "http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/conLiE.tar.gz";
sha256 = "07lbj75qqr4pq1j1qz8fyfnmrz1gnk92lnsshxycfavxl5zzdmn4";
};
buildInputs = [ bison readline ];
patchPhase = ''
substituteInPlace make_lie \
--replace \`/bin/pwd\` $out
'';
installPhase = ''
mkdir -vp $out/bin
cp -v Lie.exe $out
cp -v lie $out/bin
cp -v LEARN* $out
cp -v INFO* $out
'';
}

View file

@ -0,0 +1,133 @@
{ lib, stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
, libtiff, ncurses, pango, pcre2, perl, readline, tcl, texLive, tk, xz, zlib
, less, texinfo, graphviz, icu, pkg-config, bison, imake, which, jdk, blas, lapack
, curl, Cocoa, Foundation, libobjc, libcxx, tzdata
, withRecommendedPackages ? true
, enableStrictBarrier ? false
, enableMemoryProfiling ? false
# R as of writing does not support outputting both .so and .a files; it outputs:
# --enable-R-static-lib conflicts with --enable-R-shlib and will be ignored
, static ? false
}:
assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation rec {
pname = "R";
version = "4.2.0";
src = fetchurl {
url = "https://cran.r-project.org/src/base/R-${lib.versions.major version}/${pname}-${version}.tar.gz";
sha256 = "sha256-OOq3cZt60JU4jwaqCQxaKyAnkZRd5g0+K7DqsfUJdIg=";
};
dontUseImakeConfigure = true;
buildInputs = [
bzip2 gfortran libX11 libXmu libXt libXt libjpeg libpng libtiff ncurses
pango pcre2 perl readline texLive xz zlib less texinfo graphviz icu
pkg-config bison imake which blas lapack curl tcl tk jdk
] ++ lib.optionals stdenv.isDarwin [ Cocoa Foundation libobjc libcxx ];
patches = [
./no-usr-local-search-paths.patch
./test-reg-packages.patch
];
# Test of the examples for package 'tcltk' fails in Darwin sandbox. See:
# https://github.com/NixOS/nixpkgs/issues/146131
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace configure \
--replace "-install_name libRblas.dylib" "-install_name $out/lib/R/lib/libRblas.dylib" \
--replace "-install_name libRlapack.dylib" "-install_name $out/lib/R/lib/libRlapack.dylib" \
--replace "-install_name libR.dylib" "-install_name $out/lib/R/lib/libR.dylib"
substituteInPlace tests/Examples/Makefile.in \
--replace "test-Examples: test-Examples-Base" "test-Examples:" # do not test the examples
'';
dontDisableStatic = static;
preConfigure = ''
configureFlagsArray=(
--disable-lto
--with${lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
--with-blas="-L${blas}/lib -lblas"
--with-lapack="-L${lapack}/lib -llapack"
--with-readline
--with-tcltk --with-tcl-config="${tcl}/lib/tclConfig.sh" --with-tk-config="${tk}/lib/tkConfig.sh"
--with-cairo
--with-libpng
--with-jpeglib
--with-libtiff
--with-ICU
${lib.optionalString enableStrictBarrier "--enable-strict-barrier"}
${lib.optionalString enableMemoryProfiling "--enable-memory-profiling"}
${if static then "--enable-R-static-lib" else "--enable-R-shlib"}
AR=$(type -p ar)
AWK=$(type -p gawk)
CC=$(type -p cc)
CXX=$(type -p c++)
FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran"
JAVA_HOME="${jdk}"
RANLIB=$(type -p ranlib)
R_SHELL="${stdenv.shell}"
'' + lib.optionalString stdenv.isDarwin ''
--disable-R-framework
--without-x
OBJC="clang"
CPPFLAGS="-isystem ${lib.getDev libcxx}/include/c++/v1"
LDFLAGS="-L${lib.getLib libcxx}/lib"
'' + ''
)
echo >>etc/Renviron.in "TCLLIBPATH=${tk}/lib"
echo >>etc/Renviron.in "TZDIR=${tzdata}/share/zoneinfo"
'';
installTargets = [ "install" "install-info" "install-pdf" ];
# The store path to "which" is baked into src/library/base/R/unix/system.unix.R,
# but Nix cannot detect it as a run-time dependency because the installed file
# is compiled and compressed, which hides the store path.
postFixup = "echo ${which} > $out/nix-support/undetected-runtime-dependencies";
doCheck = true;
preCheck = "export HOME=$TMPDIR; export TZ=CET; bin/Rscript -e 'sessionInfo()'";
enableParallelBuilding = true;
# disable stackprotector on aarch64-darwin for now
# https://github.com/NixOS/nixpkgs/issues/158730
# see https://github.com/NixOS/nixpkgs/issues/127608 for a similar issue
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ];
setupHook = ./setup-hook.sh;
meta = with lib; {
homepage = "http://www.r-project.org/";
description = "Free software environment for statistical computing and graphics";
license = licenses.gpl2Plus;
longDescription = ''
GNU R is a language and environment for statistical computing and
graphics that provides a wide variety of statistical (linear and
nonlinear modelling, classical statistical tests, time-series
analysis, classification, clustering, ...) and graphical
techniques, and is highly extensible. One of R's strengths is the
ease with which well-designed publication-quality plots can be
produced, including mathematical symbols and formulae where
needed. R is an integrated suite of software facilities for data
manipulation, calculation and graphical display. It includes an
effective data handling and storage facility, a suite of operators
for calculations on arrays, in particular matrices, a large,
coherent, integrated collection of intermediate tools for data
analysis, graphical facilities for data analysis and display
either on-screen or on hardcopy, and a well-developed, simple and
effective programming language which includes conditionals, loops,
user-defined recursive functions and input and output facilities.
'';
platforms = platforms.all;
maintainers = with maintainers; [ jbedo ] ++ teams.sage.members;
};
}

View file

@ -0,0 +1,24 @@
diff -ubr R-3.0.1-orig/configure R-3.0.1/configure
--- R-3.0.1-orig/configure 2013-07-04 10:46:42.336133947 +0200
+++ R-3.0.1/configure 2013-07-04 10:46:17.181919960 +0200
@@ -3800,13 +3800,13 @@
: ${LIBnn=$libnn}
## We provide these defaults so that headers and libraries in
## '/usr/local' are found (by the native tools, mostly).
-if test -f "/sw/etc/fink.conf"; then
- : ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
- : ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
-else
- : ${CPPFLAGS="-I/usr/local/include"}
- : ${LDFLAGS="-L/usr/local/${LIBnn}"}
-fi
+# if test -f "/sw/etc/fink.conf"; then
+# : ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
+# : ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
+# else
+# : ${CPPFLAGS="-I/usr/local/include"}
+# : ${LDFLAGS="-L/usr/local/${LIBnn}"}
+# fi
## take care not to override the command-line setting
if test "${libdir}" = '${exec_prefix}/lib'; then

View file

@ -0,0 +1,7 @@
addRLibPath () {
if [[ -d "$1/library" ]]; then
addToSearchPath R_LIBS_SITE "$1/library"
fi
}
addEnvHooks "$targetOffset" addRLibPath

View file

@ -0,0 +1,15 @@
Upper bounds shifts due to extra warnings re. internet connectivity.
diff --git a/tests/reg-packages.R b/tests/reg-packages.R
index c9962ce..a40b0fa 100644
--- a/tests/reg-packages.R
+++ b/tests/reg-packages.R
@@ -260,7 +260,7 @@ stopifnot(exprs = {
(lenN <- length(print(iN <- grep("^[1-9][0-9]:", tlines)))) >= 2
iN - iw == seq_len(lenN) # these (3) lines come immediately after 'Warning',
## and "related" to the some 'missing .. paren' above:
- 8 <= print(iw - i) & iw - i <= 20 # see ~14
+ 8 <= print(iw - i) & iw - i <= 22 # see ~14
}) ## failed in R <= 4.1.1

View file

@ -0,0 +1,23 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "adolc";
version = "2.7.2";
src = fetchFromGitHub {
owner = "coin-or";
repo = "ADOL-C";
sha256 = "1w0x0p32r1amfmh2lyx33j4cb5bpkwjr5z0ll43zi5wf5gsvckd1";
rev = "releases/${version}";
};
configureFlags = [ "--with-openmp-flag=-fopenmp" ];
meta = with lib; {
description = "Automatic Differentiation of C/C++";
homepage = "https://github.com/coin-or/ADOL-C";
maintainers = [ maintainers.bzizou ];
license = licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,26 @@
{ lib, python3, fetchFromGitHub, ncurses }:
with python3.pkgs; buildPythonApplication rec {
pname = "almonds";
version = "1.25b";
src = fetchFromGitHub {
owner = "Tenchi2xh";
repo = "Almonds";
rev = version;
sha256 = "0j8d8jizivnfx8lpc4w6sbqj5hq35nfz0vdg7ld80sc5cs7jr3ws";
};
nativeBuildInputs = [ pytest ];
buildInputs = [ ncurses ];
propagatedBuildInputs = [ pillow ];
checkPhase = "py.test";
meta = with lib; {
description = "Terminal Mandelbrot fractal viewer";
homepage = "https://github.com/Tenchi2xh/Almonds";
license = licenses.mit;
maintainers = with maintainers; [ infinisil ];
};
}

View file

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchFromGitHub
, readline
, bc
, python3Packages
}:
stdenv.mkDerivation rec {
pname = "bcal";
version = "2.4";
src = fetchFromGitHub {
owner = "jarun";
repo = "bcal";
rev = "v${version}";
sha256 = "sha256-PleWU2yyJzkUAZEvEYoCGdpEXqOgRvZK9zXTYrxRtQU=";
};
buildInputs = [ readline ];
installFlags = [ "PREFIX=$(out)" ];
doCheck = true;
checkInputs = [ bc python3Packages.pytestCheckHook ];
pytestFlagsArray = [ "test.py" ];
meta = with lib; {
description = "Storage conversion and expression calculator";
homepage = "https://github.com/jarun/bcal";
license = licenses.gpl3Only;
platforms = platforms.unix;
maintainers = with maintainers; [ jfrankenau ];
};
}

View file

@ -0,0 +1,37 @@
{ lib, stdenv, fetchurl, unzip, doxygen }:
stdenv.mkDerivation rec {
pname = "bliss";
version = "0.73";
src = fetchurl {
url = "http://www.tcs.hut.fi/Software/bliss/${pname}-${version}.zip";
sha256 = "f57bf32804140cad58b1240b804e0dbd68f7e6bf67eba8e0c0fa3a62fd7f0f84";
};
patches = fetchurl {
url = "http://scip.zib.de/download/bugfixes/scip-5.0.1/bliss-0.73.patch";
sha256 = "815868d6586bcd49ff3c28e14ccb536d38b2661151088fe08187c13909c5dab0";
};
nativeBuildInputs = [ unzip doxygen ];
preBuild = ''
doxygen Doxyfile
'';
installPhase = ''
mkdir -p $out/bin $out/share/doc/bliss $out/lib $out/include/bliss
mv bliss $out/bin
mv html/* COPYING* $out/share/doc/bliss
mv *.a $out/lib
mv *.h *.hh $out/include/bliss
'';
meta = with lib; {
description = "An open source tool for computing automorphism groups and canonical forms of graphs. It has both a command line user interface as well as C++ and C programming language APIs";
homepage = "http://www.tcs.hut.fi/Software/bliss/";
license = licenses.lgpl3;
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,47 @@
diff --git a/Makefile b/Makefile
index c823f66e..65b90c5e 100644
--- a/Makefile
+++ b/Makefile
@@ -32,9 +32,9 @@ SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \
LIBRARY_NAME := $(PROJECT)
LIB_BUILD_DIR := $(BUILD_DIR)/lib
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
-DYNAMIC_VERSION_MAJOR := 1
-DYNAMIC_VERSION_MINOR := 0
-DYNAMIC_VERSION_REVISION := 0
+DYNAMIC_VERSION_MAJOR := 1
+DYNAMIC_VERSION_MINOR := 0
+DYNAMIC_VERSION_REVISION := 0
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
#DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c48255c8..cf4c580e 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -105,7 +105,6 @@ if(USE_OPENCV)
endif()
# ---[ BLAS
-if(NOT APPLE)
set(BLAS "Atlas" CACHE STRING "Selected BLAS library")
set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
@@ -123,17 +122,6 @@ if(NOT APPLE)
list(APPEND Caffe_LINKER_LIBS PUBLIC ${MKL_LIBRARIES})
list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_MKL)
endif()
-elseif(APPLE)
- find_package(vecLib REQUIRED)
- list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${vecLib_INCLUDE_DIR})
- list(APPEND Caffe_LINKER_LIBS PUBLIC ${vecLib_LINKER_LIBS})
-
- if(VECLIB_FOUND)
- if(NOT vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")
- list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_ACCELERATE)
- endif()
- endif()
-endif()
# ---[ Python
if(BUILD_python)

View file

@ -0,0 +1,149 @@
{ config, stdenv, lib
, fetchFromGitHub
, fetchurl
, cmake
, boost
, gflags
, glog
, hdf5-cpp
, opencv3
, protobuf
, doxygen
, blas
, Accelerate, CoreGraphics, CoreVideo
, lmdbSupport ? true, lmdb
, leveldbSupport ? true, leveldb, snappy
, cudaSupport ? config.cudaSupport or false, cudaPackages ? {}
, cudnnSupport ? cudaSupport
, ncclSupport ? false
, pythonSupport ? false, python ? null, numpy ? null
, substituteAll
}:
let
inherit (cudaPackages) cudatoolkit cudnn nccl;
in
assert leveldbSupport -> (leveldb != null && snappy != null);
assert cudnnSupport -> cudaSupport;
assert ncclSupport -> cudaSupport;
assert pythonSupport -> (python != null && numpy != null);
let
toggle = bool: if bool then "ON" else "OFF";
test_model_weights = fetchurl {
url = "http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel";
sha256 = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0";
};
in
stdenv.mkDerivation rec {
pname = "caffe";
version = "1.0";
src = fetchFromGitHub {
owner = "BVLC";
repo = "caffe";
rev = version;
sha256 = "104jp3cm823i3cdph7hgsnj6l77ygbwsy35mdmzhmsi4jxprd9j3";
};
nativeBuildInputs = [ cmake doxygen ];
cmakeFlags =
# It's important that caffe is passed the major and minor version only because that's what
# boost_python expects
[ (if pythonSupport then "-Dpython_version=${python.pythonVersion}" else "-DBUILD_python=OFF")
"-DBLAS=open"
] ++ (if cudaSupport then [
"-DCUDA_ARCH_NAME=All"
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
] else [ "-DCPU_ONLY=ON" ])
++ ["-DUSE_NCCL=${toggle ncclSupport}"]
++ ["-DUSE_LEVELDB=${toggle leveldbSupport}"]
++ ["-DUSE_LMDB=${toggle lmdbSupport}"];
buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 blas ]
++ lib.optional cudaSupport cudatoolkit
++ lib.optional cudnnSupport cudnn
++ lib.optional lmdbSupport lmdb
++ lib.optional ncclSupport nccl
++ lib.optionals leveldbSupport [ leveldb snappy ]
++ lib.optionals pythonSupport [ python numpy ]
++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreVideo ]
;
propagatedBuildInputs = lib.optionals pythonSupport (
# requirements.txt
let pp = python.pkgs; in ([
pp.numpy pp.scipy pp.scikitimage pp.h5py
pp.matplotlib pp.ipython pp.networkx pp.nose
pp.pandas pp.python-dateutil pp.protobuf pp.gflags
pp.pyyaml pp.pillow pp.six
] ++ lib.optional leveldbSupport pp.leveldb)
);
outputs = [ "bin" "out" ];
propagatedBuildOutputs = []; # otherwise propagates out -> bin cycle
patches = [
./darwin.patch
] ++ lib.optional pythonSupport (substituteAll {
src = ./python.patch;
inherit (python.sourceVersion) major minor; # Should be changed in case of PyPy
});
postPatch = ''
substituteInPlace src/caffe/util/io.cpp --replace \
'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \
'SetTotalBytesLimit(kProtoReadBytesLimit)'
'' + lib.optionalString (cudaSupport && lib.versionAtLeast cudatoolkit.version "9.0") ''
# CUDA 9.0 doesn't support sm_20
sed -i 's,20 21(20) ,,' cmake/Cuda.cmake
'';
preConfigure = lib.optionalString pythonSupport ''
# We need this when building with Python bindings
export BOOST_LIBRARYDIR="${boost.out}/lib";
'';
postInstall = ''
# Internal static library.
rm $out/lib/libproto.a
# Install models
cp -a ../models $out/share/Caffe/models
moveToOutput "bin" "$bin"
'' + lib.optionalString pythonSupport ''
mkdir -p $out/${python.sitePackages}
mv $out/python/caffe $out/${python.sitePackages}
rm -rf $out/python
'';
doInstallCheck = false; # build takes more than 30 min otherwise
installCheckPhase = ''
model=bvlc_reference_caffenet
m_path="$out/share/Caffe/models/$model"
$bin/bin/caffe test \
-model "$m_path/deploy.prototxt" \
-solver "$m_path/solver.prototxt" \
-weights "${test_model_weights}"
'';
meta = with lib; {
description = "Deep learning framework";
longDescription = ''
Caffe is a deep learning framework made with expression, speed, and
modularity in mind. It is developed by the Berkeley Vision and Learning
Center (BVLC) and by community contributors.
'';
homepage = "http://caffe.berkeleyvision.org/";
maintainers = with maintainers; [ ];
broken = pythonSupport && (python.isPy310);
license = licenses.bsd2;
platforms = platforms.linux ++ platforms.darwin;
};
}

View file

@ -0,0 +1,70 @@
commit b14ca23651d390fcae4a929dedc7c33a83453a66
Author: Frederik Rietdijk <fridh@fridh.nl>
Date: Sun Feb 17 08:41:27 2019 +0100
Find boost_pythonXX
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08f56a33..0a04592a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,10 +99,10 @@ add_subdirectory(docs)
add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lint.cmake)
# ---[ pytest target
-if(BUILD_python)
- add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
- add_dependencies(pytest pycaffe)
-endif()
+# if(BUILD_python)
+# add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
+# add_dependencies(pytest pycaffe)
+# endif()
# ---[ uninstall target
configure_file(
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 4a5bac47..be026d43 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -141,37 +141,14 @@ if(BUILD_python)
# use python3
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
- find_package(NumPy 1.7.1)
- # Find the matching boost python implementation
- set(version ${PYTHONLIBS_VERSION_STRING})
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
- STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
- if("${has_more_version}" STREQUAL "")
- break()
- endif()
- endwhile()
- if(NOT Boost_PYTHON_FOUND)
- find_package(Boost 1.46 COMPONENTS python)
- endif()
else()
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
- find_package(NumPy 1.7.1)
- find_package(Boost 1.46 COMPONENTS python)
endif()
- if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
+ find_package(NumPy 1.7.1)
+ find_package(Boost 1.46 REQUIRED COMPONENTS python@major@@minor@)
+ if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON@major@@minor@_FOUND)
set(HAVE_PYTHON TRUE)
if(BUILD_python_layer)
list(APPEND Caffe_DEFINITIONS PRIVATE -DWITH_PYTHON_LAYER)

View file

@ -0,0 +1,51 @@
{ stdenv, lib, fetchurl, util-linux, makeWrapper
, enableReadline ? true, readline, ncurses }:
stdenv.mkDerivation rec {
pname = "calc";
version = "2.14.1.0";
src = fetchurl {
urls = [
"https://github.com/lcn2/calc/releases/download/${version}/${pname}-${version}.tar.bz2"
"http://www.isthe.com/chongo/src/calc/${pname}-${version}.tar.bz2"
];
sha256 = "sha256-C1YWZS4x7htUWF3MhRLQIYChL4rdwJxASdPQjttUr0A=";
};
postPatch = ''
substituteInPlace Makefile \
--replace '-install_name ''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' \
--replace '-install_name ''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}'
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ util-linux ]
++ lib.optionals enableReadline [ readline ncurses ];
makeFlags = [
"T=$(out)"
"INCDIR="
"BINDIR=/bin"
"LIBDIR=/lib"
"CALC_SHAREDIR=/share/calc"
"CALC_INCDIR=/include"
"MANDIR=/share/man/man1"
# Handle LDFLAGS defaults in calc
"DEFAULT_LIB_INSTALL_PATH=$(out)/lib"
] ++ lib.optionals enableReadline [
"READLINE_LIB=-lreadline"
"USE_READLINE=-DUSE_READLINE"
];
meta = with lib; {
description = "C-style arbitrary precision calculator";
homepage = "http://www.isthe.com/chongo/tech/comp/calc/";
# The licensing situation depends on readline (see section 3 of the LGPL)
# If linked against readline then GPLv2 otherwise LGPLv2.1
license = with licenses; if enableReadline then gpl2Only else lgpl21Only;
maintainers = with maintainers; [ matthewbauer ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,23 @@
diff --git a/ccx_2.19/src/Makefile b/ccx_2.19/src/Makefile
index c503513..8a69a0c 100755
--- a/ccx_2.19/src/Makefile
+++ b/ccx_2.19/src/Makefile
@@ -18,15 +18,10 @@ OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)
OCCXMAIN = $(SCCXMAIN:.c=.o)
-DIR=../../../SPOOLES.2.2
+LIBS = -lpthread -lm -lc -lspooles -larpack -lblas -llapack
-LIBS = \
- $(DIR)/spooles.a \
- ../../../ARPACK/libarpack_INTEL.a \
- -lpthread -lm -lc
-
-ccx_2.19: $(OCCXMAIN) ccx_2.19.a $(LIBS)
- ./date.pl; $(CC) $(CFLAGS) -c ccx_2.19.c; $(FC) -Wall -O2 -o $@ $(OCCXMAIN) ccx_2.19.a $(LIBS) -fopenmp
+ccx_2.19: $(OCCXMAIN) ccx_2.19.a
+ $(CC) $(CFLAGS) -c ccx_2.19.c; $(FC) -Wall -O2 -o $@ $(OCCXMAIN) ccx_2.19.a $(LIBS) -fopenmp
ccx_2.19.a: $(OCCXF) $(OCCXC)
ar vr $@ $?

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchurl, gfortran, arpack, spooles, blas, lapack }:
stdenv.mkDerivation rec {
pname = "calculix";
version = "2.19";
src = fetchurl {
url = "http://www.dhondt.de/ccx_${version}.src.tar.bz2";
sha256 = "01vdy9sns58hkm39z6d0r5y7gzqf5z493d18jin9krqib1l6jnn7";
};
nativeBuildInputs = [ gfortran ];
buildInputs = [ arpack spooles blas lapack ];
NIX_CFLAGS_COMPILE = [
"-I${spooles}/include/spooles"
"-std=legacy"
];
patches = [
./calculix.patch
];
postPatch = ''
cd ccx*/src
'';
installPhase = ''
install -Dm0755 ccx_${version} $out/bin/ccx
'';
meta = with lib; {
homepage = "http://www.calculix.de/";
description = "Three-dimensional structural finite element program";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ gebner ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchurl, zlib, bzip2 }:
stdenv.mkDerivation rec {
pname = "cbc";
version = "2.10.4";
# Note: Cbc 2.10.5 contains Clp 1.17.5 which hits this bug
# that breaks or-tools https://github.com/coin-or/Clp/issues/130
src = fetchurl {
url = "https://www.coin-or.org/download/source/Cbc/Cbc-${version}.tgz";
sha256 = "0zq66j1vvpslswhzi9yfgkv6vmg7yry4pdmfgqaqw2vhyqxnsy39";
};
# or-tools has a hard dependency on Cbc static libraries, so we build both
configureFlags = [ "-C" "--enable-static" ];
enableParallelBuilding = true;
hardeningDisable = [ "format" ];
buildInputs = [ zlib bzip2 ];
# FIXME: move share/coin/Data to a separate output?
meta = {
homepage = "https://projects.coin-or.org/Cbc";
license = lib.licenses.epl10;
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
description = "A mixed integer programming solver";
};
}

View file

@ -0,0 +1,57 @@
{ fetchFromGitHub
, lib
, SDL2
, libGL
, libarchive
, libusb-compat-0_1
, qtbase
, qmake
, git
, libpng
, pkg-config
, wrapQtAppsHook
, stdenv
}:
stdenv.mkDerivation rec {
pname = "CEmu";
version = "1.3";
src = fetchFromGitHub {
owner = "CE-Programming";
repo = "CEmu";
rev = "v${version}";
sha256 = "1wcdnzcqscawj6jfdj5wwmw9g9vsd6a1rx0rrramakxzf8b7g47r";
fetchSubmodules = true;
};
nativeBuildInputs = [
qmake
git
wrapQtAppsHook
pkg-config
];
buildInputs = [
SDL2
libGL
libarchive
libusb-compat-0_1
qtbase
libpng
];
qmakeFlags = [
"gui/qt"
"CONFIG+=ltcg"
];
meta = with lib; {
changelog = "https://github.com/CE-Programming/CEmu/releases/tag/v${version}";
description = "Third-party TI-84 Plus CE / TI-83 Premium CE emulator, focused on developer features";
homepage = "https://ce-programming.github.io/CEmu";
license = licenses.gpl3;
maintainers = with maintainers; [ luc65r ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
broken = stdenv.isDarwin;
};
}

View file

@ -0,0 +1,22 @@
{ lib, stdenv, fetchurl, zlib }:
stdenv.mkDerivation rec {
version = "1.17.6";
pname = "clp";
src = fetchurl {
url = "https://www.coin-or.org/download/source/Clp/Clp-${version}.tgz";
sha256 = "0ap1f0lxppa6pnbc4bg7ih7a96avwaki482nig8w5fr3vg9wvkzr";
};
propagatedBuildInputs = [ zlib ];
doCheck = true;
meta = with lib; {
license = licenses.epl10;
homepage = "https://github.com/coin-or/Clp";
description = "An open-source linear programming solver written in C++";
platforms = platforms.darwin ++ [ "x86_64-linux" ];
maintainers = [ maintainers.vbgl ];
};
}

View file

@ -0,0 +1,132 @@
{ lib, stdenv, fetchFromGitHub, cmake
, fetchpatch
, openblas, blas, lapack, opencv3, libzip, boost, protobuf, mpi
, onebitSGDSupport ? false
, cudaSupport ? false, cudaPackages ? {}, addOpenGLRunpath, cudatoolkit, nvidia_x11
, cudnnSupport ? cudaSupport
}:
let
inherit (cudaPackages) cudatoolkit cudnn;
in
assert cudnnSupport -> cudaSupport;
assert blas.implementation == "openblas" && lapack.implementation == "openblas";
let
# Old specific version required for CNTK.
cub = fetchFromGitHub {
owner = "NVlabs";
repo = "cub";
rev = "1.7.4";
sha256 = "0ksd5n1lxqhm5l5cd2lps4cszhjkf6gmzahaycs7nxb06qci8c66";
};
in stdenv.mkDerivation rec {
pname = "CNTK";
version = "2.7";
src = fetchFromGitHub {
owner = "Microsoft";
repo = "CNTK";
rev = "v${version}";
sha256 = "sha256-2rIrPJyvZhnM5EO6tNhF6ARTocfUHce4N0IZk/SZiaI=";
fetchSubmodules = true;
};
patches = [
# Fix build with protobuf 3.18+
# Remove with onnx submodule bump to 1.9+
(fetchpatch {
url = "https://github.com/onnx/onnx/commit/d3bc82770474761571f950347560d62a35d519d7.patch";
extraPrefix = "Source/CNTKv2LibraryDll/proto/onnx/onnx_repo/";
stripLen = 1;
sha256 = "00raqj8wx30b06ky6cdp5vvc1mrzs7hglyi6h58hchw5lhrwkzxp";
})
];
postPatch = ''
# Fix build with protobuf 3.18+
substituteInPlace Source/CNTKv2LibraryDll/Serialization.cpp \
--replace 'SetTotalBytesLimit(INT_MAX, INT_MAX)' \
'SetTotalBytesLimit(INT_MAX)' \
--replace 'SetTotalBytesLimit(limit, limit)' \
'SetTotalBytesLimit(limit)'
'';
nativeBuildInputs = [ cmake ] ++ lib.optional cudaSupport addOpenGLRunpath;
# Force OpenMPI to use g++ in PATH.
OMPI_CXX = "g++";
# Uses some deprecated tensorflow functions
NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
buildInputs = [ openblas opencv3 libzip boost protobuf mpi ]
++ lib.optional cudaSupport cudatoolkit
++ lib.optional cudnnSupport cudnn;
configureFlags = [
"--with-opencv=${opencv3}"
"--with-libzip=${libzip.dev}"
"--with-openblas=${openblas.dev}"
"--with-boost=${boost.dev}"
"--with-protobuf=${protobuf}"
"--with-mpi=${mpi}"
"--cuda=${if cudaSupport then "yes" else "no"}"
# FIXME
"--asgd=no"
] ++ lib.optionals cudaSupport [
"--with-cuda=${cudatoolkit}"
"--with-gdk-include=${cudatoolkit}/include"
"--with-gdk-nvml-lib=${nvidia_x11}/lib"
"--with-cub=${cub}"
] ++ lib.optional onebitSGDSupport "--1bitsgd=yes";
configurePhase = ''
sed -i \
-e 's,^GIT_STATUS=.*,GIT_STATUS=,' \
-e 's,^GIT_COMMIT=.*,GIT_COMMIT=v${version},' \
-e 's,^GIT_BRANCH=.*,GIT_BRANCH=v${version},' \
-e 's,^BUILDER=.*,BUILDER=nixbld,' \
-e 's,^BUILDMACHINE=.*,BUILDMACHINE=machine,' \
-e 's,^BUILDPATH=.*,BUILDPATH=/homeless-shelter,' \
-e '/git does not exist/d' \
Tools/generate_build_info
patchShebangs .
mkdir build
cd build
${lib.optionalString cudnnSupport ''
mkdir cuda
ln -s ${cudnn}/include cuda
export configureFlags="$configureFlags --with-cudnn=$PWD"
''}
../configure $configureFlags
'';
installPhase = ''
mkdir -p $out/bin
# Moving to make patchelf remove references later.
mv lib $out
cp bin/cntk $out/bin
'';
postFixup = lib.optionalString cudaSupport ''
for lib in $out/lib/*; do
addOpenGLRunpath "$lib"
done
'';
meta = with lib; {
# Newer cub is included with cudatoolkit now and it breaks the build.
# https://github.com/Microsoft/CNTK/issues/3191
broken = cudaSupport;
homepage = "https://github.com/Microsoft/CNTK";
description = "An open source deep-learning toolkit";
license = if onebitSGDSupport then licenses.unfreeRedistributable else licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,43 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "ColPack";
version = "1.0.10";
src = fetchFromGitHub {
owner = "CSCsw";
repo = pname;
rev = "v" + version;
sha256 = "1p05vry940mrjp6236c0z83yizmw9pk6ly2lb7d8rpb7j9h03glr";
};
nativeBuildInputs = [ autoreconfHook ];
configureFlags = [
"--enable-openmp=${if stdenv.isLinux then "yes" else "no"}"
"--enable-examples=no"
];
postInstall = ''
# Remove libtool archive
rm $out/lib/*.la
# Remove compiled examples (Basic examples get compiled anyway)
rm -r $out/examples
# Copy the example sources (Basic tree contains scripts and object files)
mkdir -p $out/share/ColPack/examples/Basic
cp SampleDrivers/Basic/*.cpp $out/share/ColPack/examples/Basic
cp -r SampleDrivers/Matrix* $out/share/ColPack/examples
'';
meta = with lib; {
description = "A package comprising of implementations of algorithms for
vertex coloring and derivative computation";
homepage = "http://cscapes.cs.purdue.edu/coloringpage/software.htm#functionalities";
license = licenses.lgpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ edwtjo ];
};
}

View file

@ -0,0 +1,87 @@
{ lib, stdenv, makeWrapper, openjdk, gtk2, xorg, glibcLocales, releasePath ? null }:
# To use this package, you need to download your own cplex installer from IBM
# and override the releasePath attribute to point to the location of the file.
#
# Note: cplex creates an individual build for each license which screws
# somewhat with the use of functions like requireFile as the hash will be
# different for every user.
stdenv.mkDerivation rec {
pname = "cplex";
version = "128";
src =
if releasePath == null then
throw ''
This nix expression requires that the cplex installer is already
downloaded to your machine. Get it from IBM:
https://developer.ibm.com/docloud/blog/2017/12/20/cplex-optimization-studio-12-8-now-available/
Set `cplex.releasePath = /path/to/download;` in your
~/.config/nixpkgs/config.nix for `nix-*` commands, or
`config.cplex.releasePath = /path/to/download;` in your
`configuration.nix` for NixOS.
''
else
releasePath;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ openjdk gtk2 xorg.libXtst glibcLocales ];
unpackPhase = "cp $src $name";
patchPhase = ''
sed -i -e 's|/usr/bin/tr"|tr" |' $name
'';
buildPhase = ''
sh $name -i silent -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=$out
'';
installPhase = ''
mkdir -p $out/bin
ln -s $out/opl/bin/x86-64_linux/oplrun\
$out/opl/bin/x86-64_linux/oplrunjava\
$out/opl/oplide/oplide\
$out/cplex/bin/x86-64_linux/cplex\
$out/cpoptimizer/bin/x86-64_linux/cpoptimizer\
$out/bin
'';
fixupPhase =
let
libraryPath = lib.makeLibraryPath [ stdenv.cc.cc gtk2 xorg.libXtst ];
in ''
interpreter=${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2
for pgm in $out/opl/bin/x86-64_linux/oplrun $out/opl/bin/x86-64_linux/oplrunjava $out/opl/oplide/oplide;
do
patchelf --set-interpreter "$interpreter" $pgm;
wrapProgram $pgm \
--prefix LD_LIBRARY_PATH : $out/opl/bin/x86-64_linux:${libraryPath} \
--set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive;
done
for pgm in $out/cplex/bin/x86-64_linux/cplex $out/cpoptimizer/bin/x86-64_linux/cpoptimizer $out/opl/oplide/jre/bin/*;
do
if grep ELF $pgm > /dev/null;
then
patchelf --set-interpreter "$interpreter" $pgm;
fi
done
'';
passthru = {
libArch = "x86-64_linux";
libSuffix = "${version}0";
};
meta = with lib; {
description = "Optimization solver for mathematical programming";
homepage = "https://www.ibm.com/be-en/marketplace/ibm-ilog-cplex";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ bfortz ];
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchurl, blas, gfortran, lapack }:
stdenv.mkDerivation rec {
pname = "csdp";
version = "6.1.1";
src = fetchurl {
url = "https://www.coin-or.org/download/source/Csdp/Csdp-${version}.tgz";
sha256 = "1f9ql6cjy2gwiyc51ylfan24v1ca9sjajxkbhszlds1lqmma8n05";
};
buildInputs = [ blas gfortran.cc.lib lapack ];
postPatch = ''
substituteInPlace Makefile --replace /usr/local/bin $out/bin
'';
preInstall = ''
rm -f INSTALL
mkdir -p $out/bin
'';
meta = {
homepage = "https://projects.coin-or.org/Csdp";
license = lib.licenses.cpl10;
maintainers = [ lib.maintainers.roconnor ];
description = "A C Library for Semidefinite Programming";
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "dap";
version = "3.10";
src = fetchurl {
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
sha256 = "Bk5sty/438jLb1PpurMQ5OqMbr6JqUuuQjcg2bejh2Y=";
};
hardeningDisable = [ "format" ];
meta = with lib; {
homepage = "https://www.gnu.org/software/dap";
description = "A small statistics and graphics package based on C";
longDescription = ''
Dap is a small statistics and graphics package based on C. Version 3.0 and
later of Dap can read SBS programs (based on the utterly famous, industry
standard statistics system with similar initials - you know the one I
mean)! The user wishing to perform basic statistical analyses is now freed
from learning and using C syntax for straightforward tasks, while
retaining access to the C-style graphics and statistics features provided
by the original implementation. Dap provides core methods of data
management, analysis, and graphics that are commonly used in statistical
consulting practice (univariate statistics, correlations and regression,
ANOVA, categorical data analysis, logistic regression, and nonparametric
analyses).
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, gmp, m4 }:
let
pname = "ecm";
version = "7.0.4";
name = "${pname}-${version}";
in
stdenv.mkDerivation {
inherit name;
src = fetchurl {
url = "http://gforge.inria.fr/frs/download.php/file/36224/ecm-${version}.tar.gz";
sha256 = "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc";
};
# See https://trac.sagemath.org/ticket/19233
configureFlags = lib.optional stdenv.isDarwin "--disable-asm-redc";
buildInputs = [ m4 gmp ];
doCheck = true;
meta = {
description = "Elliptic Curve Method for Integer Factorization";
license = lib.licenses.gpl2Plus;
homepage = "http://ecm.gforge.inria.fr/";
maintainers = [ lib.maintainers.roconnor ];
platforms = with lib.platforms; linux ++ darwin;
};
}

View file

@ -0,0 +1,60 @@
{ lib, stdenv, fetchFromGitHub, fftw, libjpeg, log4cpp, openjpeg
, libpng12, poppler, qtbase, qt5, qmake, wrapQtAppsHook
}:
stdenv.mkDerivation rec {
pname = "engauge-digitizer";
version = "12.2.2";
src = fetchFromGitHub {
owner = "markummitchell";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Wj9o3wWbtHsEi6LFH4xDpwVR9BwcWc472jJ/QFDQZvY=";
};
nativeBuildInputs = [ qmake wrapQtAppsHook ];
buildInputs = [
qtbase
qt5.qttools
poppler
libpng12
openjpeg
openjpeg.dev
log4cpp
libjpeg
fftw
];
qmakeFlags = [
"CONFIG+=jpeg2000"
"CONFIG+=pdf"
"CONFIG+=log4cpp_null"
];
POPPLER_INCLUDE = "${poppler.dev}/include/poppler/qt5";
POPPLER_LIB = "${poppler}/lib";
OPENJPEG_INCLUDE = "${openjpeg.dev}/include/${openjpeg.pname}-${lib.versions.majorMinor openjpeg.version}";
OPENJPEG_LIB = "${openjpeg}/lib";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp bin/engauge $out/bin/
runHook postInstall
'';
meta = with lib; {
description = "Engauge Digitizer is a tool for recovering graph data from an image file";
homepage = "https://markummitchell.github.io/engauge-digitizer";
license = with licenses; [ gpl2Only ];
platforms = platforms.linux;
maintainers = [ maintainers.sheepforce ];
};
}

View file

@ -0,0 +1,73 @@
{ lib, stdenv, fetchurl, bison, flex, makeWrapper, texinfo4, getopt, readline, texlive }:
lib.fix (eukleides: stdenv.mkDerivation rec {
pname = "eukleides";
version = "1.5.4";
src = fetchurl {
url = "http://www.eukleides.org/files/${pname}-${version}.tar.bz2";
sha256 = "0s8cyh75hdj89v6kpm3z24i48yzpkr8qf0cwxbs9ijxj1i38ki0q";
};
patches = [
# use $CC instead of hardcoded gcc
./use-CC.patch
# allow PostScript transparency in epstopdf call
./gs-allowpstransparency.patch
];
nativeBuildInputs = [ bison flex texinfo4 makeWrapper ];
buildInputs = [ getopt readline ];
preConfigure = ''
substituteInPlace Makefile \
--replace mktexlsr true
substituteInPlace doc/Makefile \
--replace ginstall-info install-info
substituteInPlace Config \
--replace '/usr/local' "$out" \
--replace '$(SHARE_DIR)/texmf' "$tex"
'';
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: eukleides_build/triangle.o:(.bss+0x28): multiple definition of `A';
# eukleides_build/quadrilateral.o:(.bss+0x18): first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
preInstall = ''
mkdir -p $out/bin
'';
postInstall = ''
wrapProgram $out/bin/euktoeps \
--prefix PATH : ${lib.makeBinPath [ getopt ]}
'';
outputs = [ "out" "doc" "tex" ];
passthru.tlType = "run";
passthru.pkgs = [ eukleides.tex ]
# packages needed by euktoeps, euktopdf and eukleides.sty
++ (with texlive; collection-pstricks.pkgs ++ epstopdf.pkgs ++ iftex.pkgs ++ moreverb.pkgs);
meta = {
description = "Geometry Drawing Language";
homepage = "http://www.eukleides.org/";
license = lib.licenses.gpl3Plus;
longDescription = ''
Eukleides is a computer language devoted to elementary plane
geometry. It aims to be a fairly comprehensive system to create
geometric figures, either static or dynamic. Eukleides allows to
handle basic types of data: numbers and strings, as well as
geometric types of data: points, vectors, sets (of points), lines,
circles and conics.
'';
platforms = lib.platforms.unix;
};
})

View file

@ -0,0 +1,10 @@
--- a/bash/euktopdf
+++ b/bash/euktopdf
@@ -55,6 +55,6 @@ do
exit 1
fi
dvips -q -E -o $base.eps $base.dvi &&
- epstopdf $base.eps &&
+ epstopdf --gsopt=-dALLOWPSTRANSPARENCY $base.eps &&
rm -f $base.{tex,log,dvi,eps}
done

View file

@ -0,0 +1,11 @@
--- a/build/Makefile
+++ b/build/Makefile
@@ -11,7 +11,7 @@ LEX = flex
LFLAGS = -8
YACC = bison
YFLAGS = -d
-CC = gcc
+CC ?= gcc
IFLAGS = -I$(COMMON_DIR) -I$(MAIN_DIR) -I$(BUILD_DIR)
ifneq ($(strip $(LOCALES)),)
MOFLAGS = -DMO_DIR=\"$(MO_DIR)\"

View file

@ -0,0 +1,22 @@
{ lib, stdenv, fetchurl, gmp, zlib }:
stdenv.mkDerivation {
version = "4.2.1";
pname = "form";
# This tarball is released by author, it is not downloaded from tag, so can't use fetchFromGitHub
src = fetchurl {
url = "https://github.com/vermaseren/form/releases/download/v4.2.1/form-4.2.1.tar.gz";
sha256 = "0a0smc10gm85vxd85942n5azy88w5qs5avbqrw0lw0yb9injswpj";
};
buildInputs = [ gmp zlib ];
meta = with lib; {
description = "The FORM project for symbolic manipulation of very big expressions";
homepage = "https://www.nikhef.nl/~form/";
license = licenses.gpl3;
maintainers = [ maintainers.veprbl ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,24 @@
{ lib, stdenv, fetchurl, sbcl, libX11, libXpm, libICE, libSM, libXt, libXau, libXdmcp }:
stdenv.mkDerivation rec {
pname = "fricas";
version = "1.3.7";
src = fetchurl {
url = "mirror://sourceforge/fricas/fricas/${version}/fricas-${version}-full.tar.bz2";
sha256 = "sha256-cOqMvSe3ef/ZeVy5cj/VU/aTRtxgfxZfRbE4lWE5TU4=";
};
buildInputs = [ sbcl libX11 libXpm libICE libSM libXt libXau libXdmcp ];
dontStrip = true;
meta = {
homepage = "http://fricas.sourceforge.net/";
description = "An advanced computer algebra system";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.sprock ];
};
}

View file

@ -0,0 +1,159 @@
{ stdenv
, lib
, fetchurl
, makeWrapper
, readline
, gmp
, zlib
# one of
# - "minimal" (~400M):
# Install the bare minimum of packages required by gap to start.
# This is likely to break a lot of stuff. Do not expect upstream support with
# this configuration.
# - "standard" (~700M):
# Install the "standard packages" which gap autoloads by default. These
# packages are effectively considered a part of gap.
# - "full" (~1.7G):
# Install all available packages. This takes a lot of space.
, packageSet ? "standard"
# Kept for backwards compatibility. Overrides packageSet to "full".
, keepAllPackages ? false
}:
let
# packages absolutely required for gap to start
# `*` represents the version where applicable
requiredPackages = [
"GAPDoc-*"
"primgrp-*"
"SmallGrp-*"
"transgrp"
];
# packages autoloaded by default if available
autoloadedPackages = [
"atlasrep"
"autpgrp-*"
"alnuth-*"
"crisp-*"
"ctbllib-*"
"FactInt-*"
"fga"
"irredsol-*"
"laguna-*"
"polenta-*"
"polycyclic-*"
"resclasses-*"
"sophus-*"
"tomlib-*"
];
keepAll = keepAllPackages || (packageSet == "full");
packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
# Generate bash script that removes all packages from the `pkg` subdirectory
# that are not on the whitelist. The whitelist consists of strings expected by
# `find`'s `-name`.
removeNonWhitelistedPkgs = whitelist: ''
find pkg -type d -maxdepth 1 -mindepth 1 \
'' + (lib.concatStringsSep "\n" (map (str: "-not -name '${str}' \\") whitelist)) + ''
-exec echo "Removing package {}" \; \
-exec rm -r '{}' \;
'';
in
stdenv.mkDerivation rec {
pname = "gap";
# https://www.gap-system.org/Releases/
version = "4.11.1";
src = fetchurl {
url = "https://github.com/gap-system/gap/releases/download/v${version}/gap-${version}.tar.gz";
sha256 = "sha256-ZjXF2n2CdV+DOUhrnKwzdm9YcS8pfoI0+6QIGJAuowQ=";
};
# remove all non-essential packages (which take up a lot of space)
preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
patchShebangs .
'';
buildInputs = [
readline
gmp
zlib
];
nativeBuildInputs = [
makeWrapper
];
# "teststandard" is a superset of testinstall. It takes ~1h instead of ~1min.
# tests are run twice, once with all packages loaded and once without
# checkTarget = "teststandard";
doInstallCheck = true;
installCheckTarget = "check";
preInstallCheck = ''
# gap tests check that the home directory exists
export HOME="$TMP/gap-home"
mkdir -p "$HOME"
# make sure gap is in PATH
export PATH="$out/bin:$PATH"
# make sure we don't accidentally use the wrong gap binary
rm -r bin
# like the defaults the Makefile, but use gap from PATH instead of the
# one from builddir
installCheckFlagsArray+=(
"TESTGAP=gap --quitonbreak -b -m 100m -o 1g -q -x 80 -r -A"
"TESTGAPauto=gap --quitonbreak -b -m 100m -o 1g -q -x 80 -r"
)
'';
postBuild = ''
pushd pkg
bash ../bin/BuildPackages.sh
popd
'';
installTargets = [
"install-libgap"
"install-headers"
];
# full `make install` is not yet implemented, just for libgap and headers
postInstall = ''
# Install config.h, which is not currently handled by `make install-headers`
cp gen/config.h "$out/include/gap"
mkdir -p "$out/bin" "$out/share/gap/"
echo "Copying files to target directory"
cp -ar . "$out/share/gap/build-dir"
makeWrapper "$out/share/gap/build-dir/bin/gap.sh" "$out/bin/gap" \
--set GAP_DIR $out/share/gap/build-dir
'';
preFixup = ''
# patchelf won't strip references to the build dir if it still exists
rm -rf pkg
'';
meta = with lib; {
description = "Computational discrete algebra system";
maintainers = with maintainers;
[
raskin
chrisjefferson
timokau
];
platforms = platforms.all;
broken = stdenv.isDarwin;
# keeping all packages increases the package size considerably, which is
# why a local build is preferable in that situation. The timeframe is
# reasonable and that way the binary cache doesn't get overloaded.
hydraPlatforms = lib.optionals (!keepAllPackages) meta.platforms;
license = licenses.gpl2;
homepage = "https://www.gap-system.org";
};
}

View file

@ -0,0 +1,92 @@
{ lib, stdenv, fetchurl, jre, makeDesktopItem, makeWrapper, unzip, language ? "en_US" }:
let
pname = "geogebra";
version = "5-0-706-0";
srcIcon = fetchurl {
url = "http://static.geogebra.org/images/geogebra-logo.svg";
sha256 = "01sy7ggfvck350hwv0cla9ynrvghvssqm3c59x4q5lwsxjsxdpjm";
};
desktopItem = makeDesktopItem {
name = "geogebra";
exec = "geogebra";
icon = "geogebra";
desktopName = "Geogebra";
genericName = "Geogebra";
comment = meta.description;
categories = [ "Education" "Science" "Math" ];
mimeTypes = [ "application/vnd.geogebra.file" "application/vnd.geogebra.tool" ];
};
meta = with lib; {
description = "Dynamic mathematics software with graphics, algebra and spreadsheets";
longDescription = ''
Dynamic mathematics software for all levels of education that brings
together geometry, algebra, spreadsheets, graphing, statistics and
calculus in one easy-to-use package.
'';
homepage = "https://www.geogebra.org/";
maintainers = with maintainers; [ sikmir imsofi ];
license = with licenses; [ gpl3 cc-by-nc-sa-30 geogebra ];
platforms = with platforms; linux ++ darwin;
hydraPlatforms = [];
};
linuxPkg = stdenv.mkDerivation {
inherit pname version meta srcIcon desktopItem;
preferLocalBuild = true;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
"https://web.archive.org/web/20220516130744/https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
];
sha256 = "d18f3d20baff693606331f035fa4bf73e7418d28090f038054da98444b06f69b";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
install -D geogebra/* -t "$out/libexec/geogebra/"
makeWrapper "$out/libexec/geogebra/geogebra" "$out/bin/geogebra" \
--set JAVACMD "${jre}/bin/java" \
--set GG_PATH "$out/libexec/geogebra" \
--add-flags "--language=${language}"
install -Dm644 "${desktopItem}/share/applications/"* \
-t $out/share/applications/
install -Dm644 "${srcIcon}" \
"$out/share/icons/hicolor/scalable/apps/geogebra.svg"
'';
};
darwinPkg = stdenv.mkDerivation {
inherit pname version meta;
preferLocalBuild = true;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/5.0/GeoGebra-MacOS-Installer-withJava-${version}.zip"
"https://web.archive.org/web/20220516132502/https://download.geogebra.org/installers/5.0/GeoGebra-MacOS-Installer-withJava-${version}.zip"
];
sha256 = "0070ec8d8d5f79c921b5d7433048c2c114ec4b812d839bb04e67848fce24ee0a";
};
dontUnpack = true;
nativeBuildInputs = [ unzip ];
installPhase = ''
install -dm755 $out/Applications
unzip $src -d $out/Applications
'';
};
in
if stdenv.isDarwin
then darwinPkg
else linuxPkg

View file

@ -0,0 +1,73 @@
{ lib, stdenv, unzip, fetchurl, electron, makeWrapper, geogebra }:
let
pname = "geogebra";
version = "6-0-676-0";
srcIcon = geogebra.srcIcon;
desktopItem = geogebra.desktopItem;
meta = with lib; geogebra.meta // {
license = licenses.geogebra;
maintainers = with maintainers; [ voidless sikmir ];
platforms = with platforms; linux ++ darwin;
};
linuxPkg = stdenv.mkDerivation {
inherit pname version meta;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip"
"https://web.archive.org/web/20211123222708/https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip"
];
sha256 = "0wn90n2nd476rkf83gk9vvcpbjflkrvyri50pnmv52j76n023hmm";
};
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [
unzip
makeWrapper
];
unpackPhase = ''
unzip $src
'';
installPhase = ''
mkdir -p $out/libexec/geogebra/ $out/bin
cp -r GeoGebra-linux-x64/{resources,locales} "$out/"
makeWrapper ${lib.getBin electron}/bin/electron $out/bin/geogebra --add-flags "$out/resources/app"
install -Dm644 "${desktopItem}/share/applications/"* \
-t $out/share/applications/
install -Dm644 "${srcIcon}" \
"$out/share/icons/hicolor/scalable/apps/geogebra.svg"
'';
};
darwinPkg = stdenv.mkDerivation {
inherit pname version meta;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip"
"https://web.archive.org/web/20211124143625/https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip"
];
sha256 = "1dwv2f94a1c2y10lmy0i66cafynalp7dkqgnpk4f0mk6pir2fdgj";
};
dontUnpack = true;
nativeBuildInputs = [ unzip ];
installPhase = ''
install -dm755 $out/Applications
unzip $src -d $out/Applications
'';
};
in
if stdenv.isDarwin
then darwinPkg
else linuxPkg

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, cmake, gfortran, blas, lapack, mpi, petsc, python3 }:
stdenv.mkDerivation rec {
pname = "getdp";
version = "3.4.0";
src = fetchurl {
url = "http://getdp.info/src/getdp-${version}-source.tgz";
sha256 = "sha256-d5YxJgtMf94PD6EHvIXpPBFPKC+skI/2v1K5Sad51hA=";
};
inherit (petsc) mpiSupport;
nativeBuildInputs = [ cmake python3 ];
buildInputs = [ gfortran blas lapack petsc ]
++ lib.optional mpiSupport mpi
;
cmakeFlags = lib.optional mpiSupport "-DENABLE_MPI=1";
meta = with lib; {
description = "A General Environment for the Treatment of Discrete Problems";
longDescription = ''
GetDP is a free finite element solver using mixed elements to discretize
de Rham-type complexes in one, two and three dimensions. The main
feature of GetDP is the closeness between the input data defining
discrete problems (written by the user in ASCII data files) and the
symbolic mathematical expressions of these problems.
'';
homepage = "http://getdp.info/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,30 @@
{lib, stdenv, fetchurl, gmp, mpir, cddlib}:
stdenv.mkDerivation rec {
pname = "gfan";
version = "0.6.2";
src = fetchurl {
url = "http://home.math.au.dk/jensen/software/gfan/gfan${version}.tar.gz";
sha256 = "02pihqb1lb76a0xbfwjzs1cd6ay3ldfxsm8dvsbl6qs3vkjxax56";
};
patches = [
./gfan-0.6.2-cddlib-prefix.patch
];
postPatch = lib.optionalString stdenv.cc.isClang ''
substituteInPlace Makefile --replace "-fno-guess-branch-probability" ""
'';
buildFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "CXX=${stdenv.cc.targetPrefix}c++" ];
installFlags = [ "PREFIX=$(out)" ];
buildInputs = [ gmp mpir cddlib ];
meta = {
description = "A software package for computing Gröbner fans and tropical varieties";
license = lib.licenses.gpl2 ;
maintainers = [lib.maintainers.raskin];
platforms = lib.platforms.unix;
homepage = "http://home.math.au.dk/jensen/software/gfan/gfan.html";
};
}

View file

@ -0,0 +1,55 @@
diff -ru gfan0.6.2.orig/src/app_librarytest.cpp gfan0.6.2/src/app_librarytest.cpp
--- gfan0.6.2.orig/src/app_librarytest.cpp 2020-10-19 08:41:27.981863500 +0900
+++ gfan0.6.2/src/app_librarytest.cpp 2020-10-19 08:42:44.551863500 +0900
@@ -12,8 +12,8 @@
#include "setoper.h"
#include "cdd.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
#endif
#include <iostream>
#include <fstream>
diff -ru gfan0.6.2.orig/src/gfanlib_zcone.cpp gfan0.6.2/src/gfanlib_zcone.cpp
--- gfan0.6.2.orig/src/gfanlib_zcone.cpp 2020-10-19 08:41:27.981863500 +0900
+++ gfan0.6.2/src/gfanlib_zcone.cpp 2020-10-19 08:42:44.571863500 +0900
@@ -16,8 +16,8 @@
#include "setoper.h"
#include "cdd.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
#endif
//}
@@ -52,8 +52,8 @@
"dd_free_global_constants()\n"
"in your deinitialisation code (only available for cddlib version>=094d).\n"
"This requires the header includes:\n"
- "#include \"cdd/setoper.h\"\n"
- "#include \"cdd/cdd.h\"\n"
+ "#include \"cddlib/setoper.h\"\n"
+ "#include \"cddlib/cdd.h\"\n"
"\n"
"Alternatively, you may call gfan:initializeCddlibIfRequired() and deinitializeCddlibIfRequired()\n"
"if gfanlib is the only code using cddlib. If at some point cddlib is no longer required by gfanlib\n"
diff -ru gfan0.6.2.orig/src/lp_cdd.cpp gfan0.6.2/src/lp_cdd.cpp
--- gfan0.6.2.orig/src/lp_cdd.cpp 2020-10-19 08:41:27.991863500 +0900
+++ gfan0.6.2/src/lp_cdd.cpp 2020-10-19 08:42:44.571863500 +0900
@@ -5,9 +5,9 @@
#include "cdd.h"
#include "cdd_f.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
-#include "cdd/cdd_f.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
+#include "cddlib/cdd_f.h"
#endif
//}
#include "termorder.h"

View file

@ -0,0 +1,116 @@
{ stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, lapack, blas
, autoreconfHook, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
, buildPackages, readline, gettext, libpng, libao, gfortran, perl
, enableGUI ? false, libGL, libGLU, xorg, fltk
, enableMicroPy ? false, python3
}:
assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation rec {
pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
version = "1.9.0-5"; # TODO try to remove preCheck phase on upgrade
src = fetchurl {
url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
sha256 = "sha256-EP8wRi8QZPrr1lfKN6da87s1FCy8AuDYbzcvsJCWyLE=";
};
patches = [
(fetchpatch {
name = "pari_2_11.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/giac/patches/pari_2_11.patch?id=21ba7540d385a9864b44850d6987893dfa16bfc0";
sha256 = "sha256-vEo/5MNzMdYRPWgLFPsDcMT1W80Qzj4EPBjx/B8j68k=";
})
] ++ lib.optionals (!enableGUI) [
# when enableGui is false, giac is compiled without fltk. That
# means some outputs differ in the make check. Patch around this:
(fetchpatch {
name = "nofltk-check.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/giac/patches/nofltk-check.patch?id=7553a3c8dfa7bcec07241a07e6a4e7dcf5bb4f26";
sha256 = "0xkmfc028vg5w6va04gp2x2iv31n8v4shd6vbyvk4blzgfmpj2cw";
})
];
# 1.9.0-5's tarball contains a binary (src/mkjs) which is executed
# at build time. we will delete and rebuild it.
depsBuildBuild = [ buildPackages.stdenv.cc ];
postPatch = ''
for i in doc/*/Makefile* micropython*/xcas/Makefile*; do
substituteInPlace "$i" --replace "/bin/cp" "cp";
done;
rm src/mkjs
substituteInPlace src/Makefile.am --replace "g++ mkjs.cc" \
"${buildPackages.stdenv.cc.targetPrefix}c++ mkjs.cc"
'';
nativeBuildInputs = [
autoreconfHook texlive.combined.scheme-small bison flex
];
# perl is only needed for patchShebangs fixup.
buildInputs = [
gmp mpfr pari ntl gsl blas mpfi glpk nauty
readline gettext libpng libao perl ecm
# gfortran.cc default output contains static libraries compiled without -fPIC
# we want libgfortran.so.3 instead
(lib.getLib gfortran.cc)
lapack blas
] ++ lib.optionals enableGUI [
libGL libGLU fltk xorg.libX11
] ++ lib.optional enableMicroPy python3;
# xcas Phys and Turtle menus are broken with split outputs
# and interactive use is likely to need docs
outputs = [ "out" ] ++ lib.optional (!enableGUI) "doc";
doCheck = true;
preCheck = lib.optionalString (!enableGUI) ''
# even with the nofltk patch, some changes in src/misc.cc (grep
# for HAVE_LIBFLTK) made it so that giac behaves differently
# when fltk is disabled. disable these tests for now.
echo > check/chk_fhan2
echo > check/chk_fhan9
'';
enableParallelBuilding = true;
configureFlags = [
"--enable-gc" "--enable-png" "--enable-gsl" "--enable-lapack"
"--enable-pari" "--enable-ntl" "--enable-gmpxx" # "--enable-cocoa"
"--enable-ao" "--enable-ecm" "--enable-glpk"
] ++ lib.optionals enableGUI [
"--enable-gui" "--with-x"
] ++ lib.optional (!enableMicroPy) "--disable-micropy";
postInstall = ''
# example Makefiles contain the full path to some commands
# notably texlive, and we don't want texlive to become a runtime
# dependency
for file in $(find $out -name Makefile) ; do
sed -i "s@/nix/store/[^/]*/bin/@@" "$file" ;
done;
# reference cycle
rm "$out/share/giac/doc/el/"{casinter,tutoriel}/Makefile
if [ -n "$doc" ]; then
mkdir -p "$doc/share/giac"
mv "$out/share/giac/doc" "$doc/share/giac"
mv "$out/share/giac/examples" "$doc/share/giac"
fi
'' + lib.optionalString (!enableGUI) ''
for i in pixmaps application-registry applications icons; do
rm -r "$out/share/$i";
done;
'';
meta = with lib; {
description = "A free computer algebra system (CAS)";
homepage = "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html";
license = licenses.gpl3Plus;
platforms = platforms.linux ++ (optionals (!enableGUI) platforms.darwin);
maintainers = [ maintainers.symphorien ];
};
}

View file

@ -0,0 +1,35 @@
{ lib, stdenv, fetchurl, cln, pkg-config, readline, gmp, python3 }:
stdenv.mkDerivation rec {
pname = "ginac";
version = "1.8.2";
src = fetchurl {
url = "https://www.ginac.de/ginac-${version}.tar.bz2";
sha256 = "sha256-v811Gryviv3bg5WMKtInY6deokAyVT5QPumzjj6jtsM=";
};
propagatedBuildInputs = [ cln ];
buildInputs = [ readline ]
++ lib.optional stdenv.isDarwin gmp;
nativeBuildInputs = [ pkg-config python3 ];
strictDeps = true;
preConfigure = ''
patchShebangs ginsh
'';
configureFlags = [ "--disable-rpath" ];
meta = with lib; {
broken = stdenv.isDarwin;
description = "GiNaC is Not a CAS";
homepage = "https://www.ginac.de/";
maintainers = with maintainers; [ lovek323 ];
license = licenses.gpl2;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,67 @@
{ lib
, stdenv
, fetchurl
, ocamlPackages
, makeWrapper
, libGLU
, libGL
, freeglut
, mpfr
, gmp
, pkgsHostTarget
}:
let
inherit (pkgsHostTarget.targetPackages.stdenv) cc;
in
stdenv.mkDerivation rec {
pname = "glsurf";
version = "3.3.1";
src = fetchurl {
url = "https://raffalli.eu/~christophe/glsurf/glsurf-${version}.tar.gz";
sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7";
};
nativeBuildInputs = [
makeWrapper
] ++ (with ocamlPackages; [
ocaml
findlib
]);
buildInputs = [
freeglut
libGL
libGLU
mpfr
gmp
] ++ (with ocamlPackages; [
camlp4
lablgl
camlimages_4_2_4
]);
postPatch = ''
for f in callbacks*/Makefile src/Makefile; do
substituteInPlace "$f" --replace "+camlp4" \
"${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4"
done
'';
installPhase = ''
mkdir -p $out/bin $out/share/doc/glsurf
cp ./src/glsurf.opt $out/bin/glsurf
cp ./doc/doc.pdf $out/share/doc/glsurf
cp -r ./examples $out/share/doc/glsurf
wrapProgram "$out/bin/glsurf" --set CC "${cc}/bin/${cc.targetPrefix}cc"
'';
meta = {
homepage = "https://raffalli.eu/~christophe/glsurf/";
description = "A program to draw implicit surfaces and curves";
license = lib.licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
, zlib, libGL, libGLU, xorg, opencascade-occt }:
assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation rec {
pname = "gmsh";
version = "4.10.2";
src = fetchurl {
url = "https://gmsh.info/src/gmsh-${version}-source.tgz";
sha256 = "sha256-2SEQnmxBn2jVUH2WEu6BXUC1I5pdsXXygoXgzQ2/JRc=";
};
buildInputs = [
blas lapack gmm fltk libjpeg zlib opencascade-occt
] ++ lib.optionals (!stdenv.isDarwin) [
libGL libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes
xorg.libXext xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM
xorg.libICE
];
nativeBuildInputs = [ cmake gfortran ];
doCheck = true;
meta = {
description = "A three-dimensional finite element mesh generator";
homepage = "https://gmsh.info/";
license = lib.licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,43 @@
{ lib, stdenv, fetchurl, curl, fftw, gmp, gnuplot, gtk3, gtksourceview3, json-glib
, lapack, libxml2, mpfr, openblas, pkg-config, readline }:
stdenv.mkDerivation rec {
pname = "gretl";
version = "2022a";
src = fetchurl {
url = "mirror://sourceforge/gretl/${pname}-${version}.tar.xz";
sha256 = "sha256-J+JcuCda2xYJ5aVz6UXR+nWiid6QxpDtt4DXlb6L4UA=";
};
buildInputs = [
curl
fftw
gmp
gnuplot
gtk3
gtksourceview3
json-glib
lapack
libxml2
mpfr
openblas
readline
];
nativeBuildInputs = [ pkg-config ];
enableParallelBuilding = true;
meta = with lib; {
description = "A software package for econometric analysis";
longDescription = ''
gretl is a cross-platform software package for econometric analysis,
written in the C programming language.
'';
homepage = "http://gretl.sourceforge.net";
license = licenses.gpl3;
maintainers = with maintainers; [ dmrauh ];
platforms = with platforms; all;
};
}

View file

@ -0,0 +1,54 @@
{ stdenv, lib, fetchurl, autoPatchelfHook, python3 }:
stdenv.mkDerivation rec {
pname = "gurobi";
version = "9.5.1";
src = fetchurl {
url = "https://packages.gurobi.com/${lib.versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
sha256 = "sha256-+oKFnTPwj7iuudpmsPvZFxjtVzxTT1capSNyyd64kdo=";
};
sourceRoot = "gurobi${builtins.replaceStrings ["."] [""] version}/linux64";
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ (python3.withPackages (ps: [ ps.gurobipy ])) ];
strictDeps = true;
makeFlags = [ "--directory=src/build" ];
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin/
rm $out/bin/gurobi.sh
rm $out/bin/python*
cp lib/gurobi.py $out/bin/gurobi.sh
mkdir -p $out/include
cp include/gurobi*.h $out/include/
mkdir -p $out/lib
cp lib/*.jar $out/lib/
cp lib/libGurobiJni*.so $out/lib/
cp lib/libgurobi*.so* $out/lib/
cp lib/libgurobi*.a $out/lib/
cp src/build/*.a $out/lib/
mkdir -p $out/share/java
ln -s $out/lib/gurobi.jar $out/share/java/
ln -s $out/lib/gurobi-javadoc.jar $out/share/java/
'';
passthru.libSuffix = lib.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor version);
meta = with lib; {
description = "Optimization solver for mathematical programming";
homepage = "https://www.gurobi.com";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ jfrankenau ];
};
}

View file

@ -0,0 +1,42 @@
{ lib, stdenv, fetchurl, ghostscript }:
stdenv.mkDerivation rec {
pname = "hmetis";
version = "1.5";
src = fetchurl {
url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/hmetis/hmetis-${version}-linux.tar.gz";
sha256 = "e835a098c046e9c26cecb8addfea4d18ff25214e49585ffd87038e72819be7e1";
};
nativeBuildInputs = [ ghostscript ];
binaryFiles = "hmetis khmetis shmetis";
patchPhase = ''
for binaryfile in $binaryFiles; do
patchelf \
--set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.cc.libc}/lib \
$binaryfile
done
'';
buildPhase = ''
gs -sOutputFile=manual.pdf -sDEVICE=pdfwrite -SNOPAUSE -dBATCH manual.ps
'';
installPhase = ''
mkdir -p $out/bin $out/share/doc/hmetis $out/lib
mv $binaryFiles $out/bin
mv manual.pdf $out/share/doc/hmetis
mv libhmetis.a $out/lib
'';
meta = with lib; {
description = "hMETIS is a set of programs for partitioning hypergraphs";
homepage = "http://glaros.dtc.umn.edu/gkhome/metis/hmetis/overview";
license = licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,25 @@
{ lib, stdenv, fetchurl, gfortran, blas, lapack }:
stdenv.mkDerivation rec {
pname = "JAGS";
version = "4.3.0";
src = fetchurl {
url = "mirror://sourceforge/mcmc-jags/JAGS-${version}.tar.gz";
sha256 = "1z3icccg2ic56vmhyrpinlsvpq7kcaflk1731rgpvz9bk1bxvica";
};
nativeBuildInputs = [ gfortran ];
buildInputs = [ blas lapack ];
configureFlags = [ "--with-blas=-lblas" "--with-lapack=-llapack" ];
meta = with lib; {
description = "Just Another Gibbs Sampler";
license = licenses.gpl2;
homepage = "http://mcmc-jags.sourceforge.net";
maintainers = [ maintainers.andres ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,52 @@
{ lib, stdenv, fetchurl, cctools, fixDarwinDylibNames }:
stdenv.mkDerivation rec {
pname = "lp_solve";
version = "5.5.2.11";
src = fetchurl {
url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_source.tar.gz";
sha256 = "sha256-bUq/9cxqqpM66ObBeiJt8PwLZxxDj2lxXUHQn+gfkC8=";
};
nativeBuildInputs = lib.optionals stdenv.isDarwin [
cctools
fixDarwinDylibNames
];
dontConfigure = true;
buildPhase = let
ccc = if stdenv.isDarwin then "ccc.osx" else "ccc";
in ''
runHook preBuild
(cd lpsolve55 && bash -x -e ${ccc})
(cd lp_solve && bash -x -e ${ccc})
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -d -m755 $out/bin $out/lib $out/include/lpsolve
install -m755 lp_solve/bin/*/lp_solve -t $out/bin
install -m644 lpsolve55/bin/*/liblpsolve* -t $out/lib
install -m644 lp_*.h -t $out/include/lpsolve
rm $out/lib/liblpsolve*.a
rm $out/include/lpsolve/lp_solveDLL.h # A Windows header
runHook postInstall
'';
meta = with lib; {
description = "A Mixed Integer Linear Programming (MILP) solver";
homepage = "http://lpsolve.sourceforge.net";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ smironov ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv
, fetchFromBitbucket
, autoreconfHook
}:
stdenv.mkDerivation rec {
version = "2.1";
pname = "lrcalc";
src = fetchFromBitbucket {
owner = "asbuch";
repo = "lrcalc";
rev = "lrcalc-${version}";
sha256 = "0s3amf3z75hnrjyszdndrvk4wp5p630dcgyj341i6l57h43d1p4k";
};
doCheck = true;
nativeBuildInputs = [
autoreconfHook
];
meta = with lib; {
description = "Littlewood-Richardson calculator";
homepage = "http://math.rutgers.edu/~asbuch/lrcalc/";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,131 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, fontconfig
, freetype
, gcc
, glib
, libuuid
, libxml2
, ncurses
, opencv2
, openssl
, unixODBC
, xorg
# options
, cudaSupport
}:
let
platform =
if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then
"Linux"
else
throw "Mathematica requires i686-linux or x86_64 linux";
in
stdenv.mkDerivation rec {
inherit meta src version;
pname = "mathematica";
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
libxml2
libuuid
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
phases = "unpackPhase installPhase fixupPhase";
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -platforms=${platform} -silent
'';
preFixup = ''
echo "=== PatchElfing away ==="
# This code should be a bit forgiving of errors, unfortunately
set +e
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf --shrink-rpath "$f"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -0,0 +1,145 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, dbus
, fontconfig
, freetype
, gcc
, glib
, libGL
, libGLU
, libuuid
, libxml2
, ncurses
, opencv2
, openssl
, unixODBC
, xkeyboard_config
, xorg
, zlib
# options
, cudaSupport
}:
stdenv.mkDerivation rec {
inherit meta name src version;
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
dbus
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
xkeyboard_config
libxml2
libuuid
zlib
libGL
libGLU
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
phases = "unpackPhase installPhase fixupPhase";
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent
# Fix library paths
cd $out/libexec/Mathematica/Executables
for path in mathematica MathKernel Mathematica WolframKernel wolfram math; do
sed -i -e 's#export LD_LIBRARY_PATH$#export LD_LIBRARY_PATH=${zlib}/lib:\''${LD_LIBRARY_PATH}#' $path
done
# Fix xkeyboard config path for Qt
for path in mathematica Mathematica; do
line=$(grep -n QT_PLUGIN_PATH $path | sed 's/:.*//')
sed -i -e "$line iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"" $path
done
'';
preFixup = ''
echo "=== PatchElfing away ==="
# This code should be a bit forgiving of errors, unfortunately
set +e
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf --shrink-rpath "$f"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -0,0 +1,117 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, fontconfig
, freetype
, gcc
, glib
, ncurses
, opencv2
, openssl
, unixODBC
, xorg
# options
, cudaSupport
}:
let
platform =
if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then
"Linux"
else
throw "Mathematica requires i686-linux or x86_64 linux";
in
stdenv.mkDerivation rec {
inherit meta src version;
pname = "mathematica";
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
phases = "unpackPhase installPhase fixupPhase";
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -platforms=${platform} -silent
'';
preFixup = ''
echo "=== PatchElfing away ==="
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${ldpath}" \
"$f"
patchelf --shrink-rpath "$f"
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -0,0 +1,53 @@
{ callPackage
, config
, lib
, cudaPackages
, cudaSupport ? config.cudaSupport or false
, lang ? "en"
, version ? null
}:
let versions = callPackage ./versions.nix { };
matching-versions =
lib.sort (v1: v2: lib.versionAtLeast v1.version v2.version) (lib.filter
(v: v.lang == lang
&& (if version == null then true else isMatching v.version version))
versions);
found-version =
if matching-versions == []
then throw ("No registered Mathematica version found to match"
+ " version=${version} and language=${lang}")
else lib.head matching-versions;
specific-drv = ./. + "/(lib.versions.major found-version.version).nix";
real-drv = if lib.pathExists specific-drv
then specific-drv
else ./generic.nix;
isMatching = v1: v2:
let as = lib.splitVersion v1;
bs = lib.splitVersion v2;
n = lib.min (lib.length as) (lib.length bs);
sublist = l: lib.sublist 0 n l;
in lib.compareLists lib.compare (sublist as) (sublist bs) == 0;
in
callPackage real-drv {
inherit cudaSupport cudaPackages;
inherit (found-version) version lang src;
name = ("mathematica"
+ lib.optionalString cudaSupport "-cuda"
+ "-${found-version.version}"
+ lib.optionalString (lang != "en") "-${lang}");
meta = with lib; {
description = "Wolfram Mathematica computational software system";
homepage = "http://www.wolfram.com/mathematica/";
license = licenses.unfree;
maintainers = with maintainers; [ herberteuler ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,192 @@
{ addOpenGLRunpath
, autoPatchelfHook
, lib
, makeWrapper
, requireFile
, runCommand
, stdenv
, symlinkJoin
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, cudaPackages
, cups
, dbus
, flite
, fontconfig
, freetype
, gcc-unwrapped
, glib
, gmpxx
, keyutils
, libGL
, libGLU
, libpcap
, libtins
, libuuid
, libxkbcommon
, libxml2
, llvmPackages_12
, matio
, mpfr
, ncurses
, opencv4
, openjdk11
, openssl
, pciutils
, tre
, unixODBC
, xkeyboard_config
, xorg
, zlib
# options
, cudaSupport
}:
let cudaEnv = symlinkJoin {
name = "mathematica-cuda-env";
paths = with cudaPackages; [
cuda_cudart cuda_nvcc libcublas libcufft libcurand libcusparse
];
postBuild = ''
ln -s ${addOpenGLRunpath.driverLink}/lib/libcuda.so $out/lib
ln -s lib $out/lib64
'';
};
in stdenv.mkDerivation {
inherit meta name src version;
nativeBuildInputs = [
autoPatchelfHook
makeWrapper
] ++ lib.optional cudaSupport addOpenGLRunpath;
buildInputs = [
alsa-lib
cups.lib
dbus
flite
fontconfig
freetype
glib
gmpxx
keyutils.lib
libGL
libGLU
libpcap
libtins
libuuid
libxkbcommon
libxml2
llvmPackages_12.libllvm.lib
matio
mpfr
ncurses
opencv4
openjdk11
openssl
pciutils
tre
unixODBC
xkeyboard_config
] ++ (with xorg; [
libICE
libSM
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXinerama
libXmu
libXrandr
libXrender
libXtst
libxcb
]) ++ lib.optional cudaSupport cudaEnv;
wrapProgramFlags = [
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gcc-unwrapped.lib zlib ]}"
"--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}"
# Fix libQt errors - #96490
"--set USE_WOLFRAM_LD_LIBRARY_PATH 1"
# Fix xkeyboard config path for Qt
"--set QT_XKB_CONFIG_ROOT ${xkeyboard_config}/share/X11/xkb"
] ++ lib.optionals cudaSupport [
"--set CUDA_PATH ${cudaEnv}"
"--set NVIDIA_DRIVER_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib/libnvidia-tls.so"
"--set CUDA_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib/libcuda.so"
];
unpackPhase = ''
runHook preUnpack
# Find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
tail -c +$(($offset + 1)) $src | tar -xf -
runHook postUnpack
'';
installPhase = ''
runHook preInstall
cd "$TMPDIR/Unix/Installer"
mkdir -p "$out/lib/udev/rules.d"
# Patch MathInstaller's shebangs and udev rules dir
patchShebangs MathInstaller
substituteInPlace MathInstaller \
--replace /etc/udev/rules.d $out/lib/udev/rules.d
# Remove PATH restriction, root and avahi daemon checks, and hostname call
sed -i '
s/^PATH=/# &/
s/isRoot="false"/# &/
s/^checkAvahiDaemon$/# &/
s/`hostname`/""/
' MathInstaller
# NOTE: some files placed under HOME may be useful
XDG_DATA_HOME="$out/share" HOME="$TMPDIR/home" vernierLink=y \
./MathInstaller -execdir="$out/bin" -targetdir="$out/libexec/Mathematica" -auto -verbose -createdir=y
# Check if MathInstaller produced any errors
errLog="$out/libexec/Mathematica/InstallErrors"
if [ -f "$errLog" ]; then
echo "Installation errors:"
cat "$errLog"
return 1
fi
runHook postInstall
'';
preFixup = ''
for bin in $out/libexec/Mathematica/Executables/*; do
wrapProgram "$bin" ''${wrapProgramFlags[@]}
done
'';
dontConfigure = true;
dontBuild = true;
# This is primarily an IO bound build; there's little benefit to building remotely
preferLocalBuild = true;
# All binaries are already stripped
dontStrip = true;
# NOTE: Some deps are still not found; ignore for now
autoPatchelfIgnoreMissingDeps = true;
}

View file

@ -0,0 +1,103 @@
{ lib, requireFile }:
let versions = [
{
version = "13.0.1";
lang = "en";
language = "English";
sha256 = "sha256-NnKpIMG0rxr9SAcz9tZ2Zbr4JYdX3+WabtbXRAzybbo=";
installer = "Mathematica_13.0.1_BNDL_LINUX.sh";
}
{
version = "13.0.0";
lang = "en";
language = "English";
sha256 = "sha256-FbutOaWZUDEyXR0Xj2OwDnFwbT7JAB66bRaB+8mR0+E=";
installer = "Mathematica_13.0.0_BNDL_LINUX.sh";
}
{
version = "12.3.1";
lang = "en";
language = "English";
sha256 = "sha256-UbnKsS/ZGwCep61JaKLIpZ6U3FXS5swdcSrNW6LE1Qk=";
installer = "Mathematica_12.3.1_LINUX.sh";
}
{
version = "12.3.0";
lang = "en";
language = "English";
sha256 = "sha256-BF3wRfbnlt7Vn2TrLg8ZSayI3LodW24F+1PqCkrtchU=";
installer = "Mathematica_12.3.0_LINUX.sh";
}
{
version = "12.2.0";
lang = "en";
language = "English";
sha256 = "sha256-O2Z2ogPGrbfpxBilSEsDeXQoe1vgnGTn3+p03cDkANc=";
installer = "Mathematica_12.2.0_LINUX.sh";
}
{
version = "12.1.1";
lang = "en";
language = "English";
sha256 = "sha256-rUe4hr5KmGTXD1I/eSYVoFHU68mH2aD2VLZFtOtDswo=";
installer = "Mathematica_12.1.1_LINUX.sh";
}
{
version = "12.1.0";
lang = "en";
language = "English";
sha256 = "sha256-56P1KKOTJkQj+K9wppAsnYpej/YB3VUNL7DPLYGgqZY=";
installer = "Mathematica_12.1.0_LINUX.sh";
}
{
version = "12.0.0";
lang = "en";
language = "English";
sha256 = "sha256-uftx4a/MHXLCABlv+kNFEtII+ikg4geHhDP1BOWK6dc=";
installer = "Mathematica_12.0.0_LINUX.sh";
}
{
version = "11.3.0";
lang = "en";
language = "English";
sha256 = "sha256-D8/iCMHqyESOe+OvC9uENwsXvZxdBmwBOSjI7pWu0Q4=";
installer = "Mathematica_11.3.0_LINUX.sh";
}
{
version = "11.2.0";
lang = "ja";
language = "Japanese";
sha256 = "sha256-kWOS7dMr7YYiI430Nd2OhkJrsEMDijM28w3xDYGbSbE=";
installer = "Mathematica_11.2.0_ja_LINUX.sh";
}
{
version = "9.0.0";
lang = "en";
language = "English";
sha256 = "sha256-mKgxdd7dLWa5EOuR5C37SeU+UC9Cv5YTbY5xSK9y34A=";
installer = "Mathematica_9.0.0_LINUX.sh";
}
{
version = "10.0.2";
lang = "en";
language = "English";
sha256 = "sha256-NHUg1jzLos1EsIr8TdYdNaA5+3jEcFqVZIr9GVVUXrQ=";
installer = "Mathematica_10.0.2_LINUX.sh";
}
];
in
lib.flip map versions ({ version, lang, language, sha256, installer }: {
inherit version lang;
src = requireFile {
name = installer;
message = ''
This nix expression requires that ${installer} is
already part of the store. Find the file on your Mathematica CD
and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
'';
inherit sha256;
};
})

View file

@ -0,0 +1,124 @@
{ lib
, stdenv
, fetchurl
, fetchpatch
, texinfo
, perl
, python3
, makeWrapper
, autoreconfHook
, rlwrap ? null
, tk ? null
, gnuplot ? null
, lisp-compiler
}:
let
# Allow to remove some executables from the $PATH of the wrapped binary
searchPath = lib.makeBinPath
(lib.filter (x: x != null) [ lisp-compiler rlwrap tk gnuplot ]);
in
stdenv.mkDerivation rec {
pname = "maxima";
version = "5.45.1";
src = fetchurl {
url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
sha256 = "sha256-/pAWJ2lwvvIUoaJENIVYZEUU1/36pPyLnQ6Hr8u059w=";
};
nativeBuildInputs = [
autoreconfHook
lisp-compiler
makeWrapper
python3
texinfo
];
strictDeps = true;
checkInputs = [
gnuplot
];
postPatch = ''
substituteInPlace doc/info/Makefile.am --replace "/usr/bin/env perl" "${perl}/bin/perl"
'';
postInstall = ''
# Make sure that maxima can find its runtime dependencies.
for prog in "$out/bin/"*; do
wrapProgram "$prog" --prefix PATH ":" "$out/bin:${searchPath}"
done
# Move emacs modules and documentation into the right place.
mkdir -p $out/share/emacs $out/share/doc
ln -s ../maxima/${version}/emacs $out/share/emacs/site-lisp
ln -s ../maxima/${version}/doc $out/share/doc/maxima
''
+ (lib.optionalString (lisp-compiler.pname == "ecl") ''
cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${version}/binary-ecl/"
'')
;
patches = [
# fix path to info dir (see https://trac.sagemath.org/ticket/11348)
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/infodir.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "09v64n60f7i6frzryrj0zd056lvdpms3ajky4f9p6kankhbiv21x";
})
# fix https://sourceforge.net/p/maxima/bugs/2596/
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/matrixexp.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "06961hn66rhjijfvyym21h39wk98sfxhp051da6gz0n9byhwc6zg";
})
# undo https://sourceforge.net/p/maxima/code/ci/f5e9b0f7eb122c4e48ea9df144dd57221e5ea0ca
# see https://trac.sagemath.org/ticket/13364#comment:93
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/undoing_true_false_printing_patch.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx";
})
] ++ lib.optionals (lisp-compiler.pname == "ecl") [
# build fasl, needed for ECL support
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/maxima.system.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
})
];
# The test suite is disabled since 5.42.2 because of the following issues:
#
# Error(s) found:
# /build/maxima-5.44.0/share/linearalgebra/rtest_matrixexp.mac problems:
# (20 21 22)
# Tests that were expected to fail but passed:
# /build/maxima-5.44.0/share/vector/rtest_vect.mac problem:
# (19)
# 3 tests failed out of 16,184 total tests.
#
# These failures don't look serious. It would be nice to fix them, but I
# don't know how and probably won't have the time to find out.
doCheck = false; # try to re-enable after next version update
enableParallelBuilding = true;
passthru = {
inherit lisp-compiler;
};
meta = with lib; {
description = "Computer algebra system";
homepage = "http://maxima.sourceforge.net";
license = licenses.gpl2Plus;
longDescription = ''
Maxima is a fairly complete computer algebra system written in
lisp with an emphasis on symbolic computation. It is based on
DOE-MACSYMA and licensed under the GPL. Its abilities include
symbolic integration, 3D plotting, and an ODE solver.
'';
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, zlib, gmp, ecm }:
stdenv.mkDerivation rec {
pname = "msieve";
version = "1.53";
src = fetchurl {
url = "mirror://sourceforge/msieve/msieve/Msieve%20v${version}/msieve${lib.replaceStrings ["."] [""] version}_src.tar.gz";
sha256 = "1d1vv7j4rh3nnxsmvafi73qy7lw7n3akjlm5pjl3m936yapvmz65";
};
buildInputs = [ zlib gmp ecm ];
ECM = if ecm == null then "0" else "1";
# Doesn't hurt Linux but lets clang-based platforms like Darwin work fine too
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "all" ];
installPhase = ''
mkdir -p $out/bin/
cp msieve $out/bin/
'';
meta = {
description = "A C library implementing a suite of algorithms to factor large integers";
license = lib.licenses.publicDomain;
homepage = "http://msieve.sourceforge.net/";
maintainers = [ lib.maintainers.roconnor ];
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
};
}

View file

@ -0,0 +1,85 @@
{ config, stdenv, lib, fetchurl, fetchpatch, bash, cmake
, opencv3, gtest, blas, gomp, llvmPackages, perl
, cudaSupport ? config.cudaSupport or false, cudaPackages ? {}, nvidia_x11
, cudnnSupport ? cudaSupport
, cudaCapabilities ? [ "3.7" "5.0" "6.0" "7.0" "7.5" "8.0" "8.6" ]
}:
let
inherit (cudaPackages) cudatoolkit cudnn;
in
assert cudnnSupport -> cudaSupport;
stdenv.mkDerivation rec {
pname = "mxnet";
version = "1.8.0";
src = fetchurl {
name = "apache-mxnet-src-${version}-incubating.tar.gz";
url = "https://dlcdn.apache.org/incubator/mxnet/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
hash = "sha256-la/5hYlaukCcCNVRRRCuOLiEkM+2KBqzpf8PWCbI21Q=";
};
patches = [
# Fix build error https://github.com/apache/incubator-mxnet/issues/19405
(fetchpatch {
name = "mxnet-fix-gcc-linker-error-1.patch";
url = "https://github.com/apache/incubator-mxnet/commit/78e31d66d19e385ca4ef73245ce79a47e375d8d1.diff";
sha256 = "sha256-UfmGhh4RbvrEOXe6IJxHm1Aqpy1gS6gHxrX5KQBXjv4=";
})
(fetchpatch {
name = "mxnet-fix-gcc-linker-error-2.patch";
url = "https://github.com/apache/incubator-mxnet/commit/9bfe3116aabd01049fdbd90855cb245a30b795df.diff";
sha256 = "sha256-BL7Zf7Bgn0qpai9HbQ6LBxZNa3iLjVJSe5nxZgqI/fw=";
})
];
nativeBuildInputs = [ cmake perl ];
buildInputs = [ opencv3 gtest blas.provider ]
++ lib.optional stdenv.cc.isGNU gomp
++ lib.optional stdenv.cc.isClang llvmPackages.openmp
# FIXME: when cuda build is fixed, remove nvidia_x11, and use /run/opengl-driver/lib
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
++ lib.optional cudnnSupport cudnn;
cmakeFlags =
[ "-DUSE_MKL_IF_AVAILABLE=OFF" ]
++ (if cudaSupport then [
"-DUSE_OLDCMAKECUDA=ON" # see https://github.com/apache/incubator-mxnet/issues/10743
"-DCUDA_ARCH_NAME=All"
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
"-DMXNET_CUDA_ARCH=${lib.concatStringsSep ";" cudaCapabilities}"
] else [ "-DUSE_CUDA=OFF" ])
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";
postPatch = ''
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
--replace "/bin/bash" "${bash}/bin/bash"
# Build against the system version of OpenMP.
# https://github.com/apache/incubator-mxnet/pull/12160
rm -rf 3rdparty/openmp
'';
postInstall = ''
rm "$out"/lib/*.a
'';
# used to mark cudaSupport in python310Packages.mxnet as broken;
# other attributes exposed for consistency
passthru = {
inherit cudaSupport cudnnSupport cudatoolkit cudnn;
};
meta = with lib; {
description = "Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler";
homepage = "https://mxnet.incubator.apache.org/";
maintainers = with maintainers; [ abbradar ];
license = licenses.asl20;
platforms = platforms.unix;
# Build failures when linking mxnet_unit_tests: https://gist.github.com/6d17447ee3557967ec52c50d93b17a1d
broken = cudaSupport;
};
}

View file

@ -0,0 +1,87 @@
{ lib, stdenv
, fetchFromGitHub
, pkg-config
, fetchpatch
, python3
, meson
, ninja
, vala
, gtk3
, glib
, pantheon
, gtksourceview
, libgee
, nix-update-script
, webkitgtk
, libqalculate
, intltool
, gnuplot
, wrapGAppsHook
}:
stdenv.mkDerivation rec {
pname = "nasc";
version = "0.8.0";
src = fetchFromGitHub {
owner = "parnold-x";
repo = pname;
rev = version;
sha256 = "02b9a59a9fzsb6nn3ycwwbcbv04qfzm6x7csq2addpzx5wak6dd8";
fetchSubmodules = true;
};
nativeBuildInputs = [
glib # post_install.py
gtk3 # post_install.py
intltool # for libqalculate
meson
ninja
pkg-config
python3
vala
wrapGAppsHook
];
buildInputs = [
glib
gtk3
gtksourceview
libgee
pantheon.granite
webkitgtk
# We add libqalculate's runtime dependencies because nasc has it as a modified subproject.
] ++ libqalculate.buildInputs ++ libqalculate.propagatedBuildInputs;
postPatch = ''
chmod +x meson/post_install.py
patchShebangs meson/post_install.py
# patch subproject. same code in libqalculate expression
substituteInPlace subprojects/libqalculate/libqalculate/Calculator-plot.cc \
--replace 'commandline = "gnuplot"' 'commandline = "${gnuplot}/bin/gnuplot"' \
--replace '"gnuplot - ' '"${gnuplot}/bin/gnuplot - '
'';
passthru = {
updateScript = nix-update-script {
attrPath = pname;
};
};
meta = with lib; {
description = "Do maths like a normal person, designed for elementary OS";
longDescription = ''
Its an app where you do maths like a normal person. It lets you
type whatever you want and smartly figures out what is math and
spits out an answer on the right pane. Then you can plug those
answers in to future equations and if that answer changes, so does
the equations its used in.
'';
homepage = "https://github.com/parnold-x/nasc";
maintainers = teams.pantheon.members;
platforms = platforms.linux;
license = licenses.gpl3Plus;
mainProgram = "com.github.parnold_x.nasc";
};
}

View file

@ -0,0 +1,50 @@
{ stdenv
, lib
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "nauty";
version = "2.7r3";
src = fetchurl {
url = "https://pallini.di.uniroma1.it/nauty${builtins.replaceStrings ["."] [""] version}.tar.gz";
sha256 = "sha256-TwZltxalP3oU6irjAFnyPQZM4/5MEsATQE724e4LiMI=";
};
outputs = [ "out" "dev" ];
configureFlags = [
# Prevent nauty from sniffing some cpu features. While those are very
# widely available, it can lead to nasty bugs when they are not available:
# https://groups.google.com/forum/#!topic/sage-packaging/Pe4SRDNYlhA
"--enable-generic" # don't use -march=native
"--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-popcnt"
"--${if stdenv.hostPlatform.sse4_aSupport then "enable" else "disable"}-clz"
];
installPhase = ''
mkdir -p "$out"/{bin,share/doc/nauty} "$dev"/{lib,include/nauty}
find . -type f -perm -111 \! -name '*.*' \! -name configure -exec cp '{}' "$out/bin" \;
cp [Rr][Ee][Aa][Dd]* COPYRIGHT This* [Cc]hange* "$out/share/doc/nauty"
cp *.h "$dev/include/nauty"
for i in *.a; do
cp "$i" "$dev/lib/lib$i";
done
'';
checkTarget = "checks";
meta = with lib; {
description = "Programs for computing automorphism groups of graphs and digraphs";
license = licenses.asl20;
maintainers = teams.sage.members;
platforms = platforms.unix;
# I'm not sure if the filename will remain the same for future changelog or
# if it will track changes to minor releases. Lets see. Better than nothing
# in any case.
changelog = "https://pallini.di.uniroma1.it/changes24-27.txt";
homepage = "https://pallini.di.uniroma1.it/";
};
}

View file

@ -0,0 +1,40 @@
{ mkDerivation, haskellPackages, fetchurl, lib }:
mkDerivation rec {
pname = "nota";
version = "1.0";
# Can't use fetchFromGitLab since codes.kary.us doesn't support https
src = fetchurl {
url = "http://codes.kary.us/nota/nota/-/archive/V${version}/nota-V${version}.tar.bz2";
sha256 = "0bbs6bm9p852hvqadmqs428ir7m65h2prwyma238iirv42pk04v8";
};
postUnpack = ''
export sourceRoot=$sourceRoot/source
'';
isLibrary = false;
isExecutable = true;
libraryHaskellDepends = with haskellPackages; [
base
bytestring
array
split
scientific
parsec
ansi-terminal
regex-compat
containers
terminal-size
numbers
text
time
];
description = "The most beautiful command line calculator";
homepage = "https://kary.us/nota";
license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [ dtzWill ];
}

View file

@ -0,0 +1,12 @@
diff --git a/ion/src/simulator/linux/Makefile b/ion/src/simulator/linux/Makefile
index ca7da03fa..b05bba115 100644
--- a/ion/src/simulator/linux/Makefile
+++ b/ion/src/simulator/linux/Makefile
@@ -28,7 +28,6 @@ ion_src += $(addprefix ion/src/simulator/shared/, \
collect_registers.cpp \
haptics.cpp \
journal.cpp \
- platform_action_modifier_ctrl.cpp \
state_file.cpp \
)

View file

@ -0,0 +1,63 @@
{ stdenv
, lib
, fetchFromGitHub
, libpng
, libjpeg
, freetype
, xorg
, python3
, imagemagick
, gcc-arm-embedded
, pkg-config
}:
stdenv.mkDerivation rec {
pname = "numworks-epsilon";
version = "15.5.0";
src = fetchFromGitHub {
owner = "numworks";
repo = "epsilon";
rev = version;
sha256 = "fPBO3FzZ4k5OxG+Ifc6R/au4Te974HNKAEdHz+aFdSg=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libpng
libjpeg
freetype
xorg.libXext
python3
imagemagick
gcc-arm-embedded
];
makeFlags = [
"PLATFORM=simulator"
];
patches = [
# Remove make rule Introduced in cba596dde7
# which causes it to not build with nix
./0001-ion-linux-makerules.patch
];
installPhase = ''
runHook preInstall
mv ./output/release/simulator/linux/{epsilon.bin,epsilon}
mkdir -p $out/bin
cp -r ./output/release/simulator/linux/* $out/bin/
runHook postInstall
'';
meta = with lib; {
description = "Simulator for Epsilon, a High-performance graphing calculator operating system";
homepage = "https://numworks.com/";
license = licenses.cc-by-nc-sa-40;
maintainers = with maintainers; [ erikbackman ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,91 @@
{ lib
, stdenv
, fetchurl
, dimensions ? 6 # works for <= dimensions dimensions, but is only optimized for that exact value
, doSymlink ? true # symlink the executables to the default location (without dimension postfix)
}:
let
dim = toString dimensions;
in
stdenv.mkDerivation rec {
pname = "palp";
version = "2.20";
src = fetchurl {
url = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/palp/${pname}-${version}.tar.gz";
sha256 = "1q1cl3vpdir16szy0jcadysydcrjp48hqxyx42kr8g9digkqjgkj";
};
hardeningDisable = [
"format"
];
patchPhase = lib.optionalString stdenv.isDarwin ''
substituteInPlace GNUmakefile --replace gcc cc
'';
preBuild = ''
echo Building PALP optimized for ${dim} dimensions
sed -i "s/^#define[^a-zA-Z]*POLY_Dmax.*/#define POLY_Dmax ${dim}/" Global.h
'';
# palp has no tests of its own. This test is an adapted sage test that failed
# when #28029 was merged.
doCheck = true;
checkPhase = ''
./nef.x -f -N << EOF | grep -q 'np='
3 6
1 0 0 -1 0 0
0 1 0 0 -1 0
0 0 1 0 0 -1
EOF
'';
installPhase = ''
mkdir -p $out/bin
for file in poly class cws nef mori; do
cp -p $file.x "$out/bin/$file-${dim}d.x"
done
'' + lib.optionalString doSymlink ''
cd $out/bin
for file in poly class cws nef mori; do
ln -sf $file-6d.x $file.x
done
'';
meta = with lib; {
description = "A Package for Analyzing Lattice Polytopes";
longDescription = ''
A Package for Analyzing Lattice Polytopes (PALP) is a set of C
programs for calculations with lattice polytopes and applications to
toric geometry.
It contains routines for vertex and facet enumeration, computation of
incidences and symmetries, as well as completion of the set of lattice
points in the convex hull of a given set of points. In addition, there
are procedures specialised to reflexive polytopes such as the
enumeration of reflexive subpolytopes, and applications to toric
geometry and string theory, like the computation of Hodge data and
fibration structures for toric Calabi-Yau varieties. The package is
well tested and optimised in speed as it was used for time consuming
tasks such as the classification of reflexive polyhedra in 4
dimensions and the creation and manipulation of very large lists of
5-dimensional polyhedra.
While originally intended for low-dimensional applications, the
algorithms work in any dimension and our key routine for vertex and
facet enumeration compares well with existing packages.
'';
homepage = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html";
# Not really a changelog, but a one-line summary of each update that should
# be reviewed on update.
changelog = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html";
# Just a link on the website pointing to gpl -- now gplv3. When the last
# version was released that pointed to gplv2 however, so thats probably
# the right license.
license = licenses.gpl2;
maintainers = teams.sage.members;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,88 @@
{ lib
, stdenv
, fetchurl
, gmp
, libX11
, perl
, readline
, tex
, withThread ? true, libpthreadstubs
}:
assert withThread -> libpthreadstubs != null;
stdenv.mkDerivation rec {
pname = "pari";
version = "2.13.4";
src = fetchurl {
urls = [
"https://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz"
# old versions are at the url below
"https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz"
];
hash = "sha256-vN6ezq4VkoFDgcFpfNtwY1Z7ZQQgGxvke7WJIPO84YU=";
};
buildInputs = [
gmp
libX11
perl
readline
tex
] ++ lib.optionals withThread [
libpthreadstubs
];
configureScript = "./Configure";
configureFlags = [
"--with-gmp=${lib.getDev gmp}"
"--with-readline=${lib.getDev readline}"
]
++ lib.optional stdenv.isDarwin "--host=x86_64-darwin"
++ lib.optional withThread "--mt=pthread";
preConfigure = ''
export LD=$CC
'';
postConfigure = lib.optionalString stdenv.isDarwin ''
echo 'echo x86_64-darwin' > config/arch-osname
'';
makeFlags = [ "all" ];
meta = with lib; {
homepage = "http://pari.math.u-bordeaux.fr";
description = "Computer algebra system for high-performance number theory computations";
longDescription = ''
PARI/GP is a widely used computer algebra system designed for fast
computations in number theory (factorizations, algebraic number theory,
elliptic curves...), but also contains a large number of other useful
functions to compute with mathematical entities such as matrices,
polynomials, power series, algebraic numbers etc., and a lot of
transcendental functions. PARI is also available as a C library to allow
for faster computations.
Originally developed by Henri Cohen and his co-workers (Université
Bordeaux I, France), PARI is now under the GPL and maintained by Karim
Belabas with the help of many volunteer contributors.
- PARI is a C library, allowing fast computations.
- gp is an easy-to-use interactive shell giving access to the PARI
functions.
- GP is the name of gp's scripting language.
- gp2c, the GP-to-C compiler, combines the best of both worlds by
compiling GP scripts to the C language and transparently loading the
resulting functions into gp. (gp2c-compiled scripts will typically run
3 or 4 times faster.) gp2c currently only understands a subset of the
GP language.
'';
downloadPage = "http://pari.math.u-bordeaux.fr/download.html";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ ertes AndersonTorres ] ++ teams.sage.members;
platforms = platforms.linux ++ platforms.darwin;
broken = stdenv.isDarwin && stdenv.isAarch64;
mainProgram = "gp";
};
}

View file

@ -0,0 +1,34 @@
{ lib
, stdenv
, fetchurl
, pari
, perl
}:
stdenv.mkDerivation rec {
pname = "gp2c";
version = "0.0.12";
src = fetchurl {
url = "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/${pname}-${version}.tar.gz";
sha256 = "039ip7qkwwv46wrcdrz7y12m30kazzkjr44kqbc0h137g4wzd7zf";
};
buildInputs = [
pari
perl
];
configureFlags = [
"--with-paricfg=${pari}/lib/pari/pari.cfg"
"--with-perl=${perl}/bin/perl"
];
meta = with lib; {
description = "A compiler to translate GP scripts to PARI programs";
homepage = "http://pari.math.u-bordeaux.fr/";
downloadPage = "http://pari.math.u-bordeaux.fr/download.html";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ AndersonTorres ];
};
}

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchFromGitHub, bison, flex }:
stdenv.mkDerivation rec {
pname = "pcalc";
version = "20181202";
src = fetchFromGitHub {
owner = "vapier";
repo = "pcalc";
rev = "d93be9e19ecc0b2674cf00ec91cbb79d32ccb01d";
sha256 = "sha256-m4xdsEJGKxLgp/d5ipxQ+cKG3z7rlvpPL6hELnDu6Hk=";
};
makeFlags = [ "DESTDIR= BINDIR=$(out)/bin" ];
nativeBuildInputs = [ bison flex ];
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://vapier.github.io/pcalc/";
description = "Programmer's calculator";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ ftrvxmtrx ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchurl, unzip }:
stdenv.mkDerivation {
pname = "perseus";
version = "4-beta";
nativeBuildInputs = [ unzip ];
hardeningDisable = [ "stackprotector" ];
src = fetchurl {
url = "http://www.sas.upenn.edu/~vnanda/source/perseus_4_beta.zip";
sha256 = "09brijnqabhgfjlj5wny0bqm5dwqcfkp1x5wif6yzdmqh080jybj";
};
sourceRoot = ".";
buildPhase = ''
g++ Pers.cpp -O3 -fpermissive -o perseus
'';
installPhase = ''
mkdir -p $out/bin
cp perseus $out/bin
'';
meta = {
description = "The Persistent Homology Software";
longDescription = ''
Persistent homology - or simply, persistence - is an algebraic
topological invariant of a filtered cell complex. Perseus
computes this invariant for a wide class of filtrations built
around datasets arising from point samples, images, distance
matrices and so forth.
'';
homepage = "http://www.sas.upenn.edu/~vnanda/perseus/index.html";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ erikryb ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,51 @@
{ lib, stdenv, fetchurl
, perl, gmp, mpfr, flint, boost
, bliss, ppl, singular, cddlib, lrs, nauty
, ninja, ant, openjdk
, perlPackages
, makeWrapper
}:
# polymake compiles its own version of sympol and atint because we
# don't have those packages. other missing optional dependencies:
# javaview, libnormaliz, scip, soplex, jreality.
stdenv.mkDerivation rec {
pname = "polymake";
version = "4.6";
src = fetchurl {
# "The minimal version is a packager friendly version which omits
# the bundled sources of cdd, lrs, libnormaliz, nauty and jReality."
url = "https://polymake.org/lib/exe/fetch.php/download/polymake-${version}-minimal.tar.bz2";
sha256 = "sha256-QjpE3e8R6uqEV6sV3V2G3beovMbJuxF3b54pWNfc+dA=";
};
buildInputs = [
perl gmp mpfr flint boost
bliss ppl singular cddlib lrs nauty
openjdk
] ++ (with perlPackages; [
JSON TermReadLineGnu TermReadKey XMLSAX
]);
nativeBuildInputs = [
makeWrapper ninja ant perl
];
ninjaFlags = [ "-C" "build/Opt" ];
postInstall = ''
for i in "$out"/bin/*; do
wrapProgram "$i" --prefix PERL5LIB : "$PERL5LIB"
done
'';
meta = with lib; {
description = "Software for research in polyhedral geometry";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
platforms = platforms.linux;
homepage = "https://www.polymake.org/doku.php";
};
}

View file

@ -0,0 +1,51 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, primesieve
}:
stdenv.mkDerivation rec {
pname = "primecount";
version = "7.3";
src = fetchFromGitHub {
owner = "kimwalisch";
repo = "primecount";
rev = "v${version}";
hash = "sha256-hxnn1uiGSB6XRC7yK+SXTwTsJfjhemWXsMNhhL7Ghek=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ primesieve ];
cmakeFlags = [
"-DBUILD_LIBPRIMESIEVE=ON"
"-DBUILD_PRIMECOUNT=ON"
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_STATIC_LIBS=OFF"
"-DBUILD_TESTS=ON"
];
meta = with lib; {
homepage = "https://github.com/kimwalisch/primecount";
description = "Fast prime counting function implementations";
longDescription = ''
primecount is a command-line program and C/C++ library that counts the
primes below an integer x 10^31 using highly optimized implementations
of the combinatorial prime counting algorithms.
primecount includes implementations of all important combinatorial prime
counting algorithms known up to this date all of which have been
parallelized using OpenMP. primecount contains the first ever open source
implementations of the Deleglise-Rivat algorithm and Xavier Gourdon's
algorithm (that works). primecount also features a novel load balancer
that is shared amongst all implementations and that scales up to hundreds
of CPU cores. primecount has already been used to compute several prime
counting function world records.
'';
license = licenses.bsd2;
inherit (primesieve.meta) maintainers platforms;
};
}

View file

@ -0,0 +1,36 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
}:
stdenv.mkDerivation rec {
pname = "primesieve";
version = "7.9";
src = fetchFromGitHub {
owner = "kimwalisch";
repo = "primesieve";
rev = "v${version}";
hash = "sha256-lwT+adKFoNI125y5FuJMovtMh8sFi9oqMLYGLabzrCI=";
};
nativeBuildInputs = [ cmake ];
meta = with lib; {
homepage = "https://primesieve.org/";
description = "Fast C/C++ prime number generator";
longDescription = ''
primesieve is a command-line program and C/C++ library for quickly
generating prime numbers. It is very cache efficient, it detects your
CPU's L1 & L2 cache sizes and allocates its main data structures
accordingly. It is also multi-threaded by default, it uses all available
CPU cores whenever possible i.e. if sequential ordering is not
required. primesieve can generate primes and prime k-tuplets up to 264.
'';
license = licenses.bsd2;
maintainers = teams.sage.members ++
(with maintainers; [ abbradar AndersonTorres ]);
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,34 @@
{ lib, gccStdenv, fetchFromGitHub, ncurses }:
gccStdenv.mkDerivation rec {
pname = "programmer-calculator";
version = "2.2";
src = fetchFromGitHub {
owner = "alt-romes";
repo = pname;
rev = "v${version}";
sha256 = "sha256-JQcYCYKdjdy8U2XMFzqTH9kAQ7CFv0r+sC1YfuAm7p8=";
};
buildInputs = [ ncurses ];
installPhase = ''
runHook preInstall
install -Dm 555 pcalc -t "$out/bin"
runHook postInstall
'';
meta = with lib; {
description = "A terminal calculator for programmers";
longDescription = ''
Terminal calculator made for programmers working with multiple number
representations, sizes, and overall close to the bits
'';
homepage = "https://alt-romes.github.io/programmer-calculator";
changelog = "https://github.com/alt-romes/programmer-calculator/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with lib.maintainers; [ cjab ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,53 @@
{ lib, stdenv, fetchurl, libxml2, readline, zlib, perl, cairo, gtk3, gsl
, pkg-config, gtksourceview, pango, gettext, dconf
, makeWrapper, gsettings-desktop-schemas, hicolor-icon-theme
, texinfo, ssw, python3
}:
stdenv.mkDerivation rec {
pname = "pspp";
version = "1.4.1";
src = fetchurl {
url = "mirror://gnu/pspp/${pname}-${version}.tar.gz";
sha256 = "0lqrash677b09zxdlxp89z6k02y4i23mbqg83956dwl69wc53dan";
};
nativeBuildInputs = [ pkg-config texinfo python3 ];
buildInputs = [ libxml2 readline zlib perl cairo gtk3 gsl
gtksourceview pango gettext
makeWrapper gsettings-desktop-schemas hicolor-icon-theme ssw
];
doCheck = false;
enableParallelBuilding = true;
preFixup = ''
wrapProgram "$out/bin/psppire" \
--prefix XDG_DATA_DIRS : "$out/share" \
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules"
'';
meta = {
homepage = "https://www.gnu.org/software/pspp/";
description = "A free replacement for SPSS, a program for statistical analysis of sampled data";
license = lib.licenses.gpl3Plus;
longDescription = ''
PSPP is a program for statistical analysis of sampled data. It is
a Free replacement for the proprietary program SPSS.
PSPP can perform descriptive statistics, T-tests, anova, linear
and logistic regression, cluster analysis, factor analysis,
non-parametric tests and more. Its backend is designed to perform
its analyses as fast as possible, regardless of the size of the
input data. You can use PSPP with its graphical interface or the
more traditional syntax commands.
'';
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,60 @@
{ lib, stdenv
, fetchpatch
, fetchFromGitHub
, autoreconfHook
, pkg-config
, flint
, gmp
, python3
, singular
, ncurses
}:
stdenv.mkDerivation rec {
version = "0.7.29";
pname = "pynac";
src = fetchFromGitHub {
owner = "pynac";
repo = "pynac";
rev = "pynac-${version}";
sha256 = "sha256-ocR7emXtKs+Xe2f6dh4xEDAacgiolY8mtlLnWnNBS8A=";
};
patches = [
# the patch below is included in sage 9.4 and should be included
# in a future pynac release. see https://trac.sagemath.org/ticket/28357
(fetchpatch {
name = "realpartloop.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/pynac/patches/realpartloop.patch?h=9.4.beta5";
sha256 = "sha256-1nj0xtlFN5fZKEiRLD+tiW/ZtxMQre1ziEGA0OVUGE4=";
})
];
buildInputs = [
flint
gmp
singular
python3
ncurses
];
nativeBuildInputs = [
autoreconfHook
pkg-config
];
meta = with lib; {
description = "Python is Not a CAS -- modified version of Ginac";
longDescription = ''
Pynac -- "Python is Not a CAS" is a modified version of Ginac that
replaces the depency of GiNaC on CLN by a dependency instead of Python.
It is a lite version of GiNaC as well, not implementing all the features
of the full GiNaC, and it is *only* meant to be used as a Python library.
'';
homepage = "http://pynac.org";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, intltool, autoreconfHook, pkg-config, libqalculate, gtk3, wrapGAppsHook }:
stdenv.mkDerivation rec {
pname = "qalculate-gtk";
version = "4.2.0";
src = fetchFromGitHub {
owner = "qalculate";
repo = "qalculate-gtk";
rev = "v${version}";
sha256 = "sha256-SphruQ/b8z5S/wKb9yhbEy9/pwiY+frZltdIYj0CJBM=";
};
hardeningDisable = [ "format" ];
nativeBuildInputs = [ intltool pkg-config autoreconfHook wrapGAppsHook ];
buildInputs = [ libqalculate gtk3 ];
enableParallelBuilding = true;
meta = with lib; {
description = "The ultimate desktop calculator";
homepage = "http://qalculate.github.io";
maintainers = with maintainers; [ gebner doronbehar ];
license = licenses.gpl2Plus;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,35 @@
{ lib, stdenv, fetchurl, fetchpatch, gmp }:
stdenv.mkDerivation rec {
pname = "ratpoints";
version = "2.1.3.p4";
src = fetchurl {
url = "http://www.mathe2.uni-bayreuth.de/stoll/programs/ratpoints-${version}.tar.gz";
sha256 = "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4";
};
enableParallelBuilding = true;
patches = [
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/sturm_and_rp_private.patch?id=1615f58890e8f9881c4228c78a6b39b9aab1303a";
sha256 = "0q3wajncyfr3gahd8gwk9x7g56zw54lpywrl63lqk7drkf60mrcl";
})
];
buildInputs = [ gmp ];
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
buildFlags = lib.optional stdenv.isDarwin ["CCFLAGS2=-lgmp -lc -lm" "CCFLAGS=-UUSE_SSE"];
installFlags = [ "INSTALL_DIR=$(out)" ];
preInstall = ''mkdir -p "$out"/{bin,share,lib,include}'';
meta = {
description = "A program to find rational points on hyperelliptic curves";
license = lib.licenses.gpl2Plus;
maintainers = [lib.maintainers.raskin];
platforms = lib.platforms.unix;
homepage = "http://www.mathe2.uni-bayreuth.de/stoll/programs/";
};
}

View file

@ -0,0 +1,22 @@
{ lib, stdenv, fetchzip }:
stdenv.mkDerivation rec {
pname = "ries";
version = "2018.04.11-1";
# upstream does not provide a stable link
src = fetchzip {
url = "https://salsa.debian.org/debian/ries/-/archive/debian/${version}/ries-debian-${version}.zip";
sha256 = "1h2wvd4k7f0l0i1vm9niz453xdbcs3nxccmri50qyrzzzc1b0842";
};
makeFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
homepage = "https://mrob.com/pub/ries/";
description = "Tool to produce a list of equations that approximately solve to a given number";
platforms = platforms.all;
maintainers = with maintainers; [ symphorien ];
license = licenses.gpl3Plus;
};
}

View file

@ -0,0 +1,58 @@
{ lib, stdenv, fetchFromGitHub
, useCoefficients ? false
, indicateProgress ? false
, useGoogleHashmap ? false, sparsehash ? null
, fileFormat ? "lowerTriangularCsv"
}:
with lib;
assert assertOneOf "fileFormat" fileFormat
["lowerTriangularCsv" "upperTriangularCsv" "dipha"];
assert useGoogleHashmap -> sparsehash != null;
let
inherit (lib) optional;
version = "1.2.1";
in
stdenv.mkDerivation {
pname = "ripser";
inherit version;
src = fetchFromGitHub {
owner = "Ripser";
repo = "ripser";
rev = "v${version}";
sha256 = "sha256-BxmkPQ/nl5cF+xwQMTjXnLgkLgdmT/39y7Kzl2wDfpE=";
};
buildInputs = optional useGoogleHashmap sparsehash;
buildFlags = [
"-std=c++11"
"-O3"
"-D NDEBUG"
]
++ optional useCoefficients "-D USE_COEFFICIENTS"
++ optional indicateProgress "-D INDICATE_PROGRESS"
++ optional useGoogleHashmap "-D USE_GOOGLE_HASHMAP"
++ optional (fileFormat == "lowerTriangularCsv") "-D FILE_FORMAT_LOWER_TRIANGULAR_CSV"
++ optional (fileFormat == "upperTriangularCsv") "-D FILE_FORMAT_UPPER_TRIANGULAR_CSV"
++ optional (fileFormat == "dipha") "-D FILE_FORMAT_DIPHA"
;
buildPhase = "c++ ripser.cpp -o ripser $buildFlags";
installPhase = ''
mkdir -p $out/bin
cp ripser $out/bin
'';
meta = {
description = "A lean C++ code for the computation of VietorisRips persistence barcodes";
homepage = "https://github.com/Ripser/ripser";
license = lib.licenses.lgpl3;
maintainers = with lib.maintainers; [erikryb];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,25 @@
From 0eaef67b683683fb423fcb2d5096b3cdf9a4a9cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= <mkg20001@gmail.com>
Date: Sun, 22 Mar 2020 12:26:10 +0100
Subject: [PATCH] Patch plugindir to output
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 50edb74..639ee86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0 ])
PKG_CHECK_MODULES([cairo], [cairo])
PKG_CHECK_MODULES([rofi], [rofi >= 1.5.4])
-[rofi_PLUGIN_INSTALL_DIR]="`$PKG_CONFIG --variable=pluginsdir rofi`"
+[rofi_PLUGIN_INSTALL_DIR]="`echo $out/lib/rofi`"
AC_SUBST([rofi_PLUGIN_INSTALL_DIR])
LT_INIT([disable-static])
--
2.25.1

View file

@ -0,0 +1,54 @@
{ lib, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, rofi-unwrapped
, libqalculate
, glib
, cairo
, gobject-introspection
, wrapGAppsHook
}:
stdenv.mkDerivation rec {
pname = "rofi-calc";
version = "2.1.0";
src = fetchFromGitHub {
owner = "svenstaro";
repo = pname;
rev = "v${version}";
sha256 = "sha256-sfUcBSUYf/+neBAhEd5LAtMOfIbdXM/ieUOztjk8Pwg=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
gobject-introspection
wrapGAppsHook
];
buildInputs = [
rofi-unwrapped
libqalculate
glib
cairo
];
patches = [
./0001-Patch-plugindir-to-output.patch
];
postPatch = ''
sed "s|qalc_binary = \"qalc\"|qalc_binary = \"${libqalculate}/bin/qalc\"|" -i src/calc.c
'';
meta = with lib; {
description = "Do live calculations in rofi!";
homepage = "https://github.com/svenstaro/rofi-calc";
license = licenses.mit;
maintainers = with maintainers; [ luc65r albakham ];
platforms = with platforms; linux;
};
}

View file

@ -0,0 +1,78 @@
# Sage on nixos
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.
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.
## The sage build is broken
First you should find out which change to nixpkgs is at fault (if you don't already know). You can use `git-bisect` for that (see the manpage).
If the build broke as a result of a package update, try those solutions in order:
- search the [sage trac](https://trac.sagemath.org/) for keywords like "Upgrade <package>". Maybe somebody has already proposed a patch that fixes the issue. You can then add a `fetchpatch` to `sage-src.nix`.
- check if [gentoo](https://github.com/cschwan/sage-on-gentoo/tree/master/sci-mathematics/sage), [debian](https://salsa.debian.org/science-team/sagemath/tree/master/debian) or [arch linux](https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath) already solved the problem. You can then again add a `fetchpatch` to `sage-src.nix`. If applicable you should also [propose the patch upstream](#proposing-a-sage-patch).
- fix the problem yourself. First clone the sagemath source and then check out the sage version you want to patch:
```
[user@localhost ~]$ git clone https://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git checkout 8.2 # substitute the relevant version here
```
Then make the needed changes and generate a patch with `git diff`:
```
[user@localhost ~]$ <make changes>
[user@localhost ~]$ git diff -u > /path/to/nixpkgs/pkgs/applications/science/math/sage/patches/name-of-patch.patch
```
Now just add the patch to `sage-src.nix` and test your changes. If they fix the problem, [propose them upstream](#proposing-a-sage-patch) and add a link to the trac ticket.
- pin the package version in `default.nix` and add a note that explains why that is necessary.
## Proposing a sage patch
You can [login the sage trac using GitHub](https://trac.sagemath.org/login). Your username will then be `gh-<your-github-name>`. The only other way is to request a trac account via email. After that refer to [git the hard way](http://doc.sagemath.org/html/en/developer/manual_git.html#chapter-manual-git) in the sage documentation. The "easy way" requires a non-GitHub account (requested via email) and a special tool. The "hard way" is really not all that hard if you're a bit familiar with git.
Here's the gist, assuming you want to use ssh key authentication. First, [add your public ssh key](https://trac.sagemath.org/prefs/sshkeys). Then:
```
[user@localhost ~]$ git clone https://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git remote add trac git@trac.sagemath.org:sage.git -t master
[user@localhost sage]$ git checkout -b u/gh-<your-github-username>/<your-branch-name> develop
[user@localhost sage]$ <make changes>
[user@localhost sage]$ git add .
[user@localhost sage]$ git commit
[user@localhost sage]$ git show # review your changes
[user@localhost sage]$ git push --set-upstream trac u/gh-<your-github-username>/<your-branch-name>
```
You now created a branch on the trac server (you *must* follow the naming scheme as you only have push access to branches with the `u/gh-<your-github-username>/` prefix).
Now you can [create a new trac ticket](https://trac.sagemath.org/newticket).
- Write a description of the change
- set the type and component as appropriate
- write your real name in the "Authors" field
- write `u/gh-<your-github-username>/<your-branch-name>` in the "Branch" field
- click "Create ticket"
- click "Modify" on the top right of your ticket (for some reason you can only change the ticket status after you have created it)
- set the ticket status from `new` to `needs_review`
- click "Save changes"
Refer to sages [Developer's Guide](http://doc.sagemath.org/html/en/developer/index.html) for further details.
## I want to update sage
You'll need to change the `version` field in `sage-src.nix`. Afterwards just try to build and let nix tell you which patches no longer apply (hopefully because they were adopted upstream). Remove those.
Hopefully the build will succeed now. If it doesn't and the problem is obvious, fix it as described in [The sage build is broken](#the-sage-build-is-broken).
If the problem is not obvious, you can try to first update sage to an intermediate version (remember that you can also set the `version` field to any git revision of sage) and locate the sage commit that introduced the issue. You can even use `git-bisect` for that (it will only be a bit tricky to keep track of which patches to apply). Hopefully after that the issue will be obvious.
## Well, that didn't help!
If you couldn't fix the problem, create a GitHub issue on the nixpkgs repo and ping @timokau (or whoever is listed in the `maintainers` list of the sage package).
Describe what you did and why it didn't work. Afterwards it would be great if you help the next guy out and improve this documentation!

View file

@ -0,0 +1,177 @@
{ pkgs
, withDoc ? false
, requireSageTests ? true
, extraPythonPackages ? ps: []
}:
# Here sage and its dependencies are put together. Some dependencies may be pinned
# as a last resort. Patching sage for compatibility with newer dependency versions
# is always preferred, see `sage-src.nix` for that.
let
inherit (pkgs) symlinkJoin callPackage nodePackages;
python3 = pkgs.python3.override {
packageOverrides = self: super: {
# `sagelib`, i.e. all of sage except some wrappers and runtime dependencies
sagelib = self.callPackage ./sagelib.nix {
inherit flint arb;
inherit sage-src env-locations singular;
inherit (maxima) lisp-compiler;
linbox = pkgs.linbox.override { withSage = true; };
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
};
sage-docbuild = self.callPackage ./python-modules/sage-docbuild.nix {
inherit sage-src;
};
sage-setup = self.callPackage ./python-modules/sage-setup.nix {
inherit sage-src;
};
};
};
jupyter-kernel-definition = {
displayName = "SageMath ${sage-src.version}";
argv = [
"${sage-with-env}/bin/sage" # FIXME which sage
"--python"
"-m"
"sage.repl.ipython_kernel"
"-f"
"{connection_file}"
];
language = "sagemath";
# just one 16x16 logo is available
logo32 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
};
jupyter-kernel-specs = pkgs.jupyter-kernel.create {
definitions = pkgs.jupyter-kernel.default // {
sagemath = jupyter-kernel-definition;
};
};
three = callPackage ./threejs-sage.nix { };
# A bash script setting various environment variables to tell sage where
# the files its looking fore are located. Also see `sage-env`.
env-locations = callPackage ./env-locations.nix {
inherit pari_data;
inherit singular maxima;
inherit three;
cysignals = python3.pkgs.cysignals;
mathjax = nodePackages.mathjax;
};
# The shell file that gets sourced on every sage start. Will also source
# the env-locations file.
sage-env = callPackage ./sage-env.nix {
sagelib = python3.pkgs.sagelib;
sage-docbuild = python3.pkgs.sage-docbuild;
inherit env-locations;
inherit python3 singular palp flint pythonEnv maxima;
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
};
# The documentation for sage, building it takes a lot of ram.
sagedoc = callPackage ./sagedoc.nix {
inherit sage-with-env jupyter-kernel-specs;
};
# sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run.
sage-with-env = callPackage ./sage-with-env.nix {
inherit python3 pythonEnv;
inherit sage-env;
inherit singular maxima;
inherit three;
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
};
# Doesn't actually build anything, just runs sages testsuite. This is a
# separate derivation to make it possible to re-run the tests without
# rebuilding sagelib (which takes ~30 minutes).
# Running the tests should take something in the order of 1h.
sage-tests = callPackage ./sage-tests.nix {
inherit sage-with-env;
};
sage-src = callPackage ./sage-src.nix {};
pythonRuntimeDeps = with python3.pkgs; [
sagelib
sage-docbuild
cvxopt
networkx
service-identity
psutil
sympy
fpylll
matplotlib
tkinter # optional, as a matplotlib backend (use with `%matplotlib tk`)
scipy
ipywidgets
rpy2
sphinx
pillow
] ++ extraPythonPackages python3.pkgs;
pythonEnv = python3.buildEnv.override {
extraLibs = pythonRuntimeDeps;
ignoreCollisions = true;
} // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
arb = pkgs.arb.override { inherit flint; };
singular = pkgs.singular.override { inherit flint; };
maxima = pkgs.maxima.override {
lisp-compiler = pkgs.ecl.override {
# "echo syntax error | ecl > /dev/full 2>&1" segfaults in
# ECL. We apply a patch to fix it (write_error.patch), but it
# only works if threads are disabled. sage 9.2 tests this
# (src/sage/interfaces/tests.py) and ships ecl like so.
# https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/1#note_1657275
threadSupport = false;
# if we don't use the system boehmgc, sending a SIGINT to ecl
# can segfault if we it happens during memory allocation.
# src/sage/libs/ecl.pyx would intermittently fail in this case.
useBoehmgc = true;
};
};
# With openblas (64 bit), the tests fail the same way as when sage is build with
# openblas instead of openblasCompat. Apparently other packages somehow use flints
# blas when it is available. Alternative would be to override flint to use
# openblasCompat.
flint = pkgs.flint.override { withBlas = false; };
# Multiple palp dimensions need to be available and sage expects them all to be
# in the same folder.
palp = symlinkJoin {
name = "palp-${pkgs.palp.version}";
paths = [
(pkgs.palp.override { dimensions = 4; doSymlink = false; })
(pkgs.palp.override { dimensions = 5; doSymlink = false; })
(pkgs.palp.override { dimensions = 6; doSymlink = true; })
(pkgs.palp.override { dimensions = 11; doSymlink = false; })
];
};
# Sage expects those in the same directory.
pari_data = symlinkJoin {
name = "pari_data";
paths = with pkgs; [
pari-galdata
pari-seadata-small
];
};
in
# A wrapper around sage that makes sure sage finds its docs (if they were build).
callPackage ./sage.nix {
inherit sage-tests sage-with-env sagedoc jupyter-kernel-definition jupyter-kernel-specs;
inherit withDoc requireSageTests;
}

View file

@ -0,0 +1,17 @@
# Lists past failures and files associated with it. The intention is to build
# up a subset of a testsuite that catches 95% of failures that are relevant for
# distributions while only taking ~5m to run. This in turn makes it more
# reasonable to re-test sage on dependency changes and makes it easier for
# users to override the sage derivation.
# This is an experiment for now. If it turns out that there really is a small
# subset of files responsible for the vast majority of packaging tests, we can
# think about moving this upstream.
[
"src/sage/env.py" # [1]
"src/sage/misc/persist.pyx" # [1]
"src/sage/misc/inline_fortran.py" # [1]
"src/sage/repl/ipython_extension.py" # [1]
]
# Numbered list of past failures to annotate files with
# [1] PYTHONPATH related issue https://github.com/NixOS/nixpkgs/commit/ec7f569211091282410050e89e68832d4fe60528

View file

@ -0,0 +1,48 @@
{ writeTextFile
, pari_data
, pari
, singular
, maxima
, conway_polynomials
, graphs
, elliptic_curves
, polytopes_db
, gap
, combinatorial_designs
, jmol
, mathjax
, three
, cysignals
}:
# A bash script setting various environment variables to tell sage where
# the files its looking fore are located. Also see `sage-env`.
writeTextFile rec {
name = "sage-env-locations";
destination = "/${name}";
text = ''
export GP_DATA_DIR="${pari_data}/share/pari"
export PARI_DATA_DIR="${pari_data}"
export GPHELP="${pari}/bin/gphelp"
export GPDOCDIR="${pari}/share/pari/doc"
export SINGULARPATH='${singular}/share/singular'
export SINGULAR_SO='${singular}/lib/libSingular.so'
export GAP_SO='${gap}/lib/libgap.so'
export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
export MAXIMA_FAS='${maxima}/lib/maxima/${maxima.version}/binary-ecl/maxima.fas'
export MAXIMA_PREFIX="${maxima}"
export CONWAY_POLYNOMIALS_DATA_DIR='${conway_polynomials}/share/conway_polynomials'
export GRAPHS_DATA_DIR='${graphs}/share/graphs'
export ELLCURVE_DATA_DIR='${elliptic_curves}/share/ellcurves'
export POLYTOPE_DATA_DIR='${polytopes_db}/share/reflexive_polytopes'
export GAP_ROOT_DIR='${gap}/share/gap/build-dir'
export ECLDIR='${maxima.lisp-compiler}/lib/${maxima.lisp-compiler.pname}-${maxima.lisp-compiler.version}/'
export COMBINATORIAL_DESIGN_DATA_DIR="${combinatorial_designs}/share/combinatorial_designs"
export CREMONA_MINI_DATA_DIR="${elliptic_curves}/share/cremona"
export JMOL_DIR="${jmol}/share/jmol" # point to the directory that contains JmolData.jar
export JSMOL_DIR="${jmol}/share/jsmol"
export MATHJAX_DIR="${mathjax}/lib/node_modules/mathjax"
export THREEJS_DIR="${three}/lib/node_modules/three"
export SAGE_INCLUDE_DIRECTORIES="${cysignals}/${cysignals.pythonModule.sitePackages}"
'';
}

View file

@ -0,0 +1,19 @@
diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
index 67d7d2accf..18279581e2 100644
--- a/src/sage/repl/configuration.py
+++ b/src/sage/repl/configuration.py
@@ -9,10 +9,11 @@ the IPython simple prompt is being used::
sage: cmd = 'print([sys.stdin.isatty(), sys.stdout.isatty()])'
sage: import pexpect
sage: output = pexpect.run(
- ....: 'bash -c \'echo "{0}" | sage\''.format(cmd),
+ ....: 'bash -c \'export SAGE_BANNER=no; echo "{0}" | sage\''.format(cmd),
....: ).decode('utf-8', 'surrogateescape')
- sage: 'sage: [False, True]' in output
- True
+ sage: print(output)
+ sage...[False, True]
+ ...
"""
#*****************************************************************************

View file

@ -0,0 +1,87 @@
diff --git a/src/sage/env.py b/src/sage/env.py
index c4953cfa65..47b880f9ad 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -244,81 +244,8 @@ os.environ['MPMATH_SAGE'] = '1'
SAGE_BANNER = var("SAGE_BANNER", "")
SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
-
-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
- """
- Return the full path to a shared library file installed in
- ``$SAGE_LOCAL/lib`` or the directories associated with the
- Python sysconfig.
-
- This can also be passed more than one library name (e.g. for cases where
- some library may have multiple names depending on the platform) in which
- case the first one found is returned.
-
- This supports most *NIX variants (in which ``lib<libname>.so`` is found
- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
-
- For distributions like Debian that use a multiarch layout, we also try the
- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
-
- This returns ``None`` if no matching library file could be found.
-
- EXAMPLES::
-
- sage: from sage.env import _get_shared_lib_path
- sage: "gap" in _get_shared_lib_path("gap")
- True
- sage: _get_shared_lib_path("an_absurd_lib") is None
- True
-
- """
-
- for libname in libnames:
- search_directories: List[Path] = []
- patterns: List[str] = []
- if sys.platform == 'cygwin':
- # Later down we take the first matching DLL found, so search
- # SAGE_LOCAL first so that it takes precedence
- if SAGE_LOCAL:
- search_directories.append(Path(SAGE_LOCAL) / 'bin')
- search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
- # Note: The following is not very robust, since if there are multible
- # versions for the same library this just selects one more or less
- # at arbitrary. However, practically speaking, on Cygwin, there
- # will only ever be one version
- patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
- else:
- if sys.platform == 'darwin':
- ext = 'dylib'
- else:
- ext = 'so'
-
- if SAGE_LOCAL:
- search_directories.append(Path(SAGE_LOCAL) / 'lib')
- libdir = sysconfig.get_config_var('LIBDIR')
- if libdir is not None:
- libdir = Path(libdir)
- search_directories.append(libdir)
-
- multiarchlib = sysconfig.get_config_var('MULTIARCH')
- if multiarchlib is not None:
- search_directories.append(libdir / multiarchlib),
-
- patterns = [f'lib{libname}.{ext}']
-
- for directory in search_directories:
- for pattern in patterns:
- path = next(directory.glob(pattern), None)
- if path is not None:
- return str(path.resolve())
-
- # Just return None if no files were found
- return None
-
# locate libgap shared object
-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
+GAP_SO = var("GAP_SO", '/default')
# post process
if DOT_SAGE is not None and ' ' in DOT_SAGE:

View file

@ -0,0 +1,13 @@
diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
index 08c4225b87..3a9bbe4ed0 100644
--- a/src/sage/misc/sagedoc.py
+++ b/src/sage/misc/sagedoc.py
@@ -1402,6 +1402,8 @@ class _sage_doc:
sage: identity_matrix.__doc__ in browse_sage_doc(identity_matrix, 'rst')
True
sage: browse_sage_doc(identity_matrix, 'html', False) # optional - sphinx sagemath_doc_html
+ ...
+ FutureWarning: The configuration setting "embed_images" will be removed in Docutils 1.2. Use "image_loading: link".
'...div...File:...Type:...Definition:...identity_matrix...'
In the 'text' version, double colons have been replaced with

View file

@ -0,0 +1,19 @@
diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
index 02e18e67e7..2ebf6eb35f 100644
--- a/src/sage/doctest/forker.py
+++ b/src/sage/doctest/forker.py
@@ -1075,6 +1075,14 @@ class SageDocTestRunner(doctest.DocTestRunner, object):
sage: set(ex2.predecessors) == set([ex0,ex1])
True
"""
+
+ # Fix ECL dir race conditions by using a separate dir for each process
+ # (https://trac.sagemath.org/ticket/26968)
+ os.environ['MAXIMA_USERDIR'] = "{}/sage-maxima-{}".format(
+ tempfile.gettempdir(),
+ os.getpid()
+ )
+
if isinstance(globs, RecordingDict):
globs.start()
example.sequence_number = len(self.history)

View file

@ -0,0 +1,58 @@
diff --git a/src/sage/libs/linbox/conversion.pxd b/src/sage/libs/linbox/conversion.pxd
index 7794c9edc3..1753277b1f 100644
--- a/src/sage/libs/linbox/conversion.pxd
+++ b/src/sage/libs/linbox/conversion.pxd
@@ -177,9 +177,8 @@ cdef inline Vector_integer_dense new_sage_vector_integer_dense(P, DenseVector_in
- v -- linbox vector
"""
cdef Vector_integer_dense res = P()
- cdef cppvector[Integer] * vec = &v.refRep()
cdef size_t i
for i in range(<size_t> res._degree):
- mpz_set(res._entries[i], vec[0][i].get_mpz_const())
+ mpz_set(res._entries[i], v.getEntry(i).get_mpz_const())
return res
diff --git a/src/sage/libs/linbox/linbox.pxd b/src/sage/libs/linbox/linbox.pxd
index 9112d151f8..dcc482960c 100644
--- a/src/sage/libs/linbox/linbox.pxd
+++ b/src/sage/libs/linbox/linbox.pxd
@@ -32,7 +32,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
ctypedef Modular_double Field
ctypedef double Element
DenseMatrix_Modular_double(Field F, size_t m, size_t n)
- DenseMatrix_Modular_double(Field F, Element*, size_t m, size_t n)
+ DenseMatrix_Modular_double(Field F, size_t m, size_t n, Element*)
void setEntry(size_t i, size_t j, Element& a)
Element &getEntry(size_t i, size_t j)
@@ -42,7 +42,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
ctypedef Modular_float Field
ctypedef float Element
DenseMatrix_Modular_float(Field F, size_t m, size_t n)
- DenseMatrix_Modular_float(Field F, Element*, size_t m, size_t n)
+ DenseMatrix_Modular_float(Field F, size_t m, size_t n, Element*)
void setEntry(size_t i, size_t j, Element& a)
Element &getEntry(size_t i, size_t j)
@@ -101,7 +101,6 @@ cdef extern from "linbox/vector/vector.h":
DenseVector_integer (Field &F)
DenseVector_integer (Field &F, long& m)
DenseVector_integer (Field &F, cppvector[Integer]&)
- cppvector[Element]& refRep()
size_t size()
void resize(size_t)
void resize(size_t n, const Element&)
diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi
index 010365d76f..3d60726ff9 100644
--- a/src/sage/matrix/matrix_modn_dense_template.pxi
+++ b/src/sage/matrix/matrix_modn_dense_template.pxi
@@ -219,7 +219,7 @@ cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_
return 0,[]
cdef ModField *F = new ModField(<long>modulus)
- cdef DenseMatrix *A = new DenseMatrix(F[0], <ModField.Element*>entries,<Py_ssize_t>nrows, <Py_ssize_t>ncols)
+ cdef DenseMatrix *A = new DenseMatrix(F[0], <Py_ssize_t>nrows, <Py_ssize_t>ncols, <ModField.Element*>entries)
cdef Py_ssize_t r = reducedRowEchelonize(A[0])
cdef Py_ssize_t i,j
for i in range(nrows):

View file

@ -0,0 +1,61 @@
diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py
index b12d56a3c9..df9d949ed1 100644
--- a/src/sage_docbuild/__init__.py
+++ b/src/sage_docbuild/__init__.py
@@ -88,30 +88,6 @@ def builder_helper(type):
"""
Return a function which builds the documentation for
output type ``type``.
-
- TESTS:
-
- Check that :trac:`25161` has been resolved::
-
- sage: from sage_docbuild import DocBuilder, setup_parser
- sage: DocBuilder._options = setup_parser().parse_args([]) # builder_helper needs _options to be set
-
- sage: import sage_docbuild.sphinxbuild
- sage: def raiseBaseException():
- ....: raise BaseException("abort pool operation")
- sage: original_runsphinx, sage_docbuild.sphinxbuild.runsphinx = sage_docbuild.sphinxbuild.runsphinx, raiseBaseException
-
- sage: from sage.misc.temporary_file import tmp_dir
- sage: os.environ['SAGE_DOC'] = tmp_dir()
- sage: sage.env.var('SAGE_DOC') # random
- sage: from sage_docbuild import builder_helper, build_ref_doc
- sage: from sage_docbuild import _build_many as build_many
- sage: helper = builder_helper("html")
- sage: try: # optional - sagemath_doc_html
- ....: build_many(build_ref_doc, [("docname", "en", "html", {})])
- ....: except Exception as E:
- ....: "Non-exception during docbuild: abort pool operation" in str(E)
- True
"""
def f(self, *args, **kwds):
output_dir = self._output_dir(type)
@@ -139,10 +115,9 @@ def builder_helper(type):
logger.debug(build_command)
# Run Sphinx with Sage's special logger
- sys.argv = ["sphinx-build"] + build_command.split()
- from .sphinxbuild import runsphinx
+ args = "python3 -um sage_docbuild.sphinxbuild -N".split() + build_command.split()
try:
- runsphinx()
+ subprocess.check_call(args)
except Exception:
if ABORT_ON_ERROR:
raise
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index a39c99ffe9..73be823684 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -330,3 +330,8 @@ def runsphinx():
sys.stderr = saved_stderr
sys.stdout.flush()
sys.stderr.flush()
+
+if __name__ == '__main__':
+ import sys
+ sys.argv[0] = "sphinx-build"
+ runsphinx()

View file

@ -0,0 +1,21 @@
diff --git a/src/sage/lfunctions/sympow.py b/src/sage/lfunctions/sympow.py
index 92cb01fd73..b123e6accc 100644
--- a/src/sage/lfunctions/sympow.py
+++ b/src/sage/lfunctions/sympow.py
@@ -50,6 +50,7 @@ from __future__ import print_function, absolute_import
import os
+from sage.env import DOT_SAGE
from sage.structure.sage_object import SageObject
from sage.misc.all import pager
from sage.misc.verbose import verbose
@@ -78,7 +79,7 @@ class Sympow(SageObject):
"""
Used to call sympow with given args
"""
- cmd = 'sympow %s' % args
+ cmd = 'env SYMPOW_CACHEDIR="%s/sympow///" sympow %s' % (DOT_SAGE, args)
with os.popen(cmd) as f:
v = f.read().strip()
verbose(v, level=2)

View file

@ -0,0 +1,81 @@
diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
index 3f1dcdb538..b6fa8d1fbd 100644
--- a/src/sage/interfaces/tachyon.py
+++ b/src/sage/interfaces/tachyon.py
@@ -261,13 +261,13 @@ written in the sequence they are listed in the examples in this section.
The {\bf PROJECTION} keyword must be followed by one of the supported
camera projection mode identifiers {\bf PERSPECTIVE}, {\bf PERSPECTIVE_DOF},
{\bf ORTHOGRAPHIC}, or {\bf FISHEYE}. The {\bf FISHEYE} projection mode
-requires two extra parameters {\bf FOCALLENGTH} and {\bf APERTURE}
+requires two extra parameters {\bf FOCALDIST} and {\bf APERTURE}
which precede the regular camera options.
\begin{verbatim}
Camera
projection perspective_dof
- focallength 0.75
+ focaldist 0.75
aperture 0.02
Zoom 0.666667
Aspectratio 1.000000
diff --git a/src/sage/plot/plot3d/tachyon.py b/src/sage/plot/plot3d/tachyon.py
index 08caf38d67..3e827411ce 100644
--- a/src/sage/plot/plot3d/tachyon.py
+++ b/src/sage/plot/plot3d/tachyon.py
@@ -92,7 +92,7 @@ angle, right angle)::
Finally there is the ``projection='perspective_dof'`` option. ::
sage: T = Tachyon(xres=800, antialiasing=4, raydepth=10,
- ....: projection='perspective_dof', focallength='1.0', aperture='.0025')
+ ....: projection='perspective_dof', focaldist='1.0', aperture='.0025')
sage: T.light((0,5,7), 1.0, (1,1,1))
sage: T.texture('t1', opacity=1, specular=.3)
sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
@@ -186,7 +186,7 @@ class Tachyon(WithEqualityById, SageObject):
or ``'fisheye'``.
- ``frustum`` - (default ''), otherwise list of four numbers. Only
used with projection='fisheye'.
- - ``focallength`` - (default ''), otherwise a number. Only used
+ - ``focaldist`` - (default ''), otherwise a number. Only used
with projection='perspective_dof'.
- ``aperture`` - (default ''), otherwise a number. Only used
with projection='perspective_dof'.
@@ -331,7 +331,7 @@ class Tachyon(WithEqualityById, SageObject):
Use of the ``projection='perspective_dof'`` option. This may not be
implemented correctly. ::
- sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focallength='1.0', aperture='.0025')
+ sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focaldist='1.0', aperture='.0025')
sage: T.light((0,5,7), 1.0, (1,1,1))
sage: T.texture('t1', opacity=1, specular=.3)
sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
@@ -365,7 +365,7 @@ class Tachyon(WithEqualityById, SageObject):
look_at=[0, 0, 0],
viewdir=None,
projection='PERSPECTIVE',
- focallength='',
+ focaldist='',
aperture='',
frustum=''):
r"""
@@ -391,7 +391,7 @@ class Tachyon(WithEqualityById, SageObject):
self._camera_position = (-3, 0, 0) # default value
self._updir = updir
self._projection = projection
- self._focallength = focallength
+ self._focaldist = focaldist
self._aperture = aperture
self._frustum = frustum
self._objects = []
@@ -624,9 +624,9 @@ class Tachyon(WithEqualityById, SageObject):
camera_out = r"""
camera
projection %s""" % (tostr(self._projection))
- if self._focallength != '':
+ if self._focaldist != '':
camera_out = camera_out + r"""
- focallength %s""" % (float(self._focallength))
+ focaldist %s""" % (float(self._focaldist))
if self._aperture != '':
camera_out = camera_out + r"""
aperture %s""" % (float(self._aperture))

View file

@ -0,0 +1,30 @@
{ lib
, buildPythonPackage
, sage-src
, sphinx
, jupyter-sphinx
}:
buildPythonPackage rec {
version = src.version;
pname = "sage-docbuild";
src = sage-src;
propagatedBuildInputs = [
sphinx
jupyter-sphinx
];
preBuild = ''
cd pkgs/sage-docbuild
'';
doCheck = false; # we will run tests in sagedoc.nix
meta = with lib; {
description = "Build system of the Sage documentation";
homepage = "https://www.sagemath.org";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
};
}

View file

@ -0,0 +1,28 @@
{ lib
, buildPythonPackage
, sage-src
, pkgconfig # the python module, not the pkg-config alias
}:
buildPythonPackage rec {
version = src.version;
pname = "sage-setup";
src = sage-src;
buildInputs = [
pkgconfig
];
preBuild = ''
cd pkgs/sage-setup
'';
doCheck = false; # sagelib depends on sage-setup, but sage-setup's tests depend on sagelib
meta = with lib; {
description = "Build system of the Sage library";
homepage = "https://www.sagemath.org";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
};
}

View file

@ -0,0 +1,194 @@
{ stdenv
, lib
, writeTextFile
, sagelib
, sage-docbuild
, env-locations
, gfortran
, bash
, coreutils
, gnused
, gnugrep
, 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
, flintqs
, blas
, lapack
, flint
, gmp
, mpfr
, zlib
, gsl
, ntl
, jdk
, 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
stdenv.cc # for cython
bash
coreutils
gnused
gnugrep
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
flintqs
jdk # only needed for `jmol` which may be replaced in the future
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") [
flint
gap
glpk
gmp
mpfr
pari
zlib
eclib
gsl
ntl
jmol
sympow
])
}'
export CFLAGS='${
lib.concatStringsSep " " (map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
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]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
'';
} // { # equivalent of `passthru`, which `writeTextFile` doesn't support
lib = sagelib;
docbuild = sage-docbuild;
}

View file

@ -0,0 +1,150 @@
{ stdenv
, fetchFromGitHub
, fetchpatch
, runtimeShell
}:
# This file is responsible for fetching the sage source and adding necessary patches.
# It does not actually build anything, it just copies the patched sources to $out.
# This is done because multiple derivations rely on these sources and they should
# all get the same sources with the same patches applied.
let
# Fetch a diff between `base` and `rev` on sage's git server.
# Used to fetch trac tickets by setting the `base` to the last release and the
# `rev` to the last commit of the ticket.
#
# We don't use sage's own build system (which builds all its
# dependencies), so we exclude changes to "build/" from patches by
# default to avoid conflicts.
fetchSageDiff = { base, name, rev, sha256, squashed ? false, excludes ? [ "build/*" ]
, ...}@args: (
fetchpatch ({
inherit name sha256 excludes;
# There are three places to get changes from:
#
# 1) From Sage's Trac. Contains all release tags (like "9.4") and all developer
# branches (wip patches from tickets), but exports each commit as a separate
# patch, so merge commits can lead to conflicts. Used if squashed == false.
#
# The above is the preferred option. To use it, find a Trac ticket and pass the
# "Commit" field from the ticket as "rev", choosing "base" as an appropriate
# release tag, i.e. a tag that doesn't cause the patch to include a lot of
# unrelated changes. If there is no such tag (due to nonlinear history, for
# example), there are two other options, listed below.
#
# 2) From GitHub's sagemath/sage repo. This lets us use a GH feature that allows
# us to choose between a .patch file, with one patch per commit, or a .diff file,
# which squashes all commits into a single diff. This is used if squashed ==
# true. This repo has all release tags. However, it has no developer branches, so
# this option can't be used if a change wasn't yet shipped in a (possibly beta)
# release.
#
# 3) From GitHub's sagemath/sagetrac-mirror repo. Mirrors all developer branches,
# but has no release tags. The only use case not covered by 1 or 2 is when we need
# to apply a patch from an open ticket that contains merge commits.
#
# Item 3 could cover all use cases if the sagemath/sagetrack-mirror repo had
# release tags, but it requires a sha instead of a release number in "base", which
# is inconvenient.
urls = if squashed
then [
"https://github.com/sagemath/sage/compare/${base}...${rev}.diff"
"https://github.com/sagemath/sagetrac-mirror/compare/${base}...${rev}.diff"
]
else [ "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}" ];
} // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" "excludes" ])
);
in
stdenv.mkDerivation rec {
version = "9.6";
pname = "sage-src";
src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
sha256 = "sha256-QY8Yga3hD1WhSCtA2/PVry8hHlMmC31J8jCBFtWgIU0=";
};
# Patches needed because of particularities of nix or the way this is packaged.
# The goal is to upstream all of them and get rid of this list.
nixPatches = [
# Fixes a potential race condition which can lead to transient doctest failures.
./patches/fix-ecl-race.patch
# Not necessary since library location is set explicitly
# https://trac.sagemath.org/ticket/27660#ticket
./patches/do-not-test-find-library.patch
# Parallelize docubuild using subprocesses, fixing an isolation issue. See
# https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
./patches/sphinx-docbuild-subprocesses.patch
];
# Since sage unfortunately does not release bugfix releases, packagers must
# fix those bugs themselves. This is for critical bugfixes, where "critical"
# == "causes (transient) doctest failures / somebody complained".
bugfixPatches = [
# To help debug the transient error in
# https://trac.sagemath.org/ticket/23087 when it next occurs.
./patches/configurationpy-error-verbose.patch
];
# Patches needed because of package updates. We could just pin the versions of
# dependencies, but that would lead to rebuilds, confusion and the burdons of
# maintaining multiple versions of dependencies. Instead we try to make sage
# compatible with never dependency versions when possible. All these changes
# should come from or be proposed to upstream. This list will probably never
# be empty since dependencies update all the time.
packageUpgradePatches = [
# After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
# now set the cache dir to be within the .sage directory. This is not
# strictly necessary, but keeps us from littering in the user's HOME.
./patches/sympow-cache.patch
# Upstream will wait until Sage 9.7 to upgrade to linbox 1.7 because it
# does not support gcc 6. We can upgrade earlier.
# https://trac.sagemath.org/ticket/32959
./patches/linbox-1.7-upgrade.patch
# adapted from https://trac.sagemath.org/ticket/23712#comment:22
./patches/tachyon-renamed-focallength.patch
# docutils 0.18.1 now triggers Sphinx warnings. tolerate them for
# now, because patching Sphinx is not feasible. remove when Sphinx
# 5.0 hits nixpkgs.
# https://github.com/sphinx-doc/sphinx/pull/10372
./patches/docutils-0.18.1-deprecation.patch
];
patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
postPatch = ''
# Make sure sage can at least be imported without setting any environment
# variables. It won't be close to feature complete though.
sed -i \
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
src/sage/env.py
# src/doc/en/reference/spkg/conf.py expects index.rst in its directory,
# a list of external packages in the sage distribution (build/pkgs)
# generated by the bootstrap script (which we don't run). this is not
# relevant for other distributions, so remove it.
rm src/doc/en/reference/spkg/conf.py
sed -i "/spkg/d" src/doc/en/reference/index.rst
# the bootstrap script also generates installation instructions for
# arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
# we don't run the bootstrap script, so disable including the generated
# files. docbuilding fails otherwise.
sed -i "/literalinclude/d" src/doc/en/installation/source.rst
'';
buildPhase = "# do nothing";
installPhase = ''
cp -r . "$out"
'';
}

View file

@ -0,0 +1,61 @@
{ stdenv
, lib
, sage-with-env
, makeWrapper
, files ? null # "null" means run all tests
, longTests ? true # run tests marked as "long time" (roughly doubles runtime)
# Run as many tests as possible in approximately n seconds. This will give each
# file to test a "time budget" and stop tests if it is exceeded. 300 is the
# upstream default value.
# https://trac.sagemath.org/ticket/25270 for details.
, timeLimit ? null
}:
# for a quick test of some source files:
# nix-build -E 'with (import ./. {}); sage.tests.override { files = [ "src/sage/misc/cython.py" ];}'
let
src = sage-with-env.env.lib.src;
runAllTests = files == null;
testArgs = if runAllTests then "--all" else testFileList;
patienceSpecifier = if longTests then "--long" else "";
timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}";
relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
testFileList = lib.concatStringsSep " " (map relpathToArg files);
in
stdenv.mkDerivation {
version = src.version;
pname = "sage-tests";
inherit src;
buildInputs = [
makeWrapper
sage-with-env
];
dontUnpack = true;
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
# This output is not actually needed for anything, the package just
# exists to decouple the sage build from its t ests.
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"
# avoid running out of memory with many threads in subprocesses, see
# https://github.com/NixOS/nixpkgs/pull/65802
export GLIBC_TUNABLES=glibc.malloc.arena_max=4
echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
"sage" -t --timeout=0 --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
'';
}

View file

@ -0,0 +1,139 @@
{ stdenv
, lib
, makeWrapper
, sage-env
, blas
, lapack
, pkg-config
, three
, singular
, gap
, giac
, maxima
, pari
, gmp
, gfan
, python3
, flintqs
, eclib
, ntl
, ecm
, pythonEnv
}:
# lots of segfaults with (64 bit) blas
assert (!blas.isILP64) && (!lapack.isILP64);
# Wrapper that combined `sagelib` with `sage-env` to produce an actually
# executable sage. No tests are run yet and no documentation is built.
let
buildInputs = [
pythonEnv # for patchShebangs
makeWrapper
pkg-config
blas lapack
singular
three
giac
gap
pari
gmp
gfan
maxima
eclib
flintqs
ntl
ecm
];
# remove python prefix, replace "-" in the name by "_", apply patch_names
# python3.8-some-pkg-1.0 -> some_pkg-1.0
pkg_to_spkg_name = pkg: patch_names: let
parts = lib.splitString "-" pkg.name;
# remove python3.8-
stripped_parts = if (builtins.head parts) == python3.libPrefix then builtins.tail parts else parts;
version = lib.last stripped_parts;
orig_pkgname = lib.init stripped_parts;
pkgname = patch_names (lib.concatStringsSep "_" orig_pkgname);
in pkgname + "-" + version;
# return the names of all dependencies in the transitive closure
transitiveClosure = dep:
if dep == null then
# propagatedBuildInputs might contain null
# (although that might be considered a programming error in the derivation)
[]
else
[ dep ] ++ (
if builtins.hasAttr "propagatedBuildInputs" dep then
lib.unique (builtins.concatLists (map transitiveClosure dep.propagatedBuildInputs))
else
[]
);
allInputs = lib.remove null (buildInputs ++ pythonEnv.extraLibs);
transitiveDeps = lib.unique (builtins.concatLists (map transitiveClosure allInputs ));
# fix differences between spkg and sage names
# (could patch sage instead, but this is more lightweight and also works for packages depending on sage)
patch_names = builtins.replaceStrings [
"zope.interface"
"node_three"
] [
"zope_interface"
"threejs"
];
# spkg names (this_is_a_package-version) of all transitive deps
input_names = map (dep: pkg_to_spkg_name dep patch_names) transitiveDeps;
in
stdenv.mkDerivation rec {
version = src.version;
pname = "sage-with-env";
src = sage-env.lib.src;
inherit buildInputs;
configurePhase = "#do nothing";
buildPhase = ''
mkdir installed
for pkg in ${lib.concatStringsSep " " input_names}; do
touch "installed/$pkg"
done
# threejs version is in format 0.<version>.minor, but sage currently still
# relies on installed_packages for the online version of threejs to work
# and expects the format r<version>. This is a hotfix for now.
# upstream: https://trac.sagemath.org/ticket/26434
rm "installed/threejs"*
touch "installed/threejs-r${lib.versions.minor three.version}"
'';
installPhase = ''
mkdir -p "$out/var/lib/sage"
cp -r installed "$out/var/lib/sage"
mkdir -p "$out/etc"
# sage tests will try to create this file if it doesn't exist
touch "$out/etc/sage-started.txt"
mkdir -p "$out/build"
# the scripts in src/bin will find the actual sage source files using environment variables set in `sage-env`
cp -r src/bin "$out/bin"
cp -r build/bin "$out/build/bin"
# sage assumes the existence of sage-src-env-config.in means it's being executed in-tree. in this case, it
# adds SAGE_SRC/bin to PATH, breaking our wrappers
rm "$out/bin"/*.in "$out/build/bin"/*.in
cp -f '${sage-env}/sage-env' "$out/bin/sage-env"
substituteInPlace "$out/bin/sage-env" \
--subst-var-by sage-local "$out"
'';
passthru = {
env = sage-env;
};
}

View file

@ -0,0 +1,62 @@
{ lib, stdenv
, makeWrapper
, sage-tests
, sage-with-env
, jupyter-kernel-definition
, jupyter-kernel-specs
, sagedoc
, withDoc
, requireSageTests
}:
# A wrapper that makes sure sage finds its docs (if they were build) and the
# jupyter kernel spec.
stdenv.mkDerivation rec {
version = src.version;
pname = "sage";
src = sage-with-env.env.lib.src;
buildInputs = [
makeWrapper
] ++ lib.optionals requireSageTests [
# This is a hack to make sure sage-tests is evaluated. It doesn't acutally
# produce anything of value, it just decouples the tests from the build.
sage-tests
];
dontUnpack = true;
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
mkdir -p "$out/bin"
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
} \
--prefix JUPYTER_PATH : "${jupyter-kernel-specs}"
'';
doInstallCheck = withDoc;
installCheckPhase = ''
export HOME="$TMPDIR/sage-home"
mkdir -p "$HOME"
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
'';
passthru = {
tests = sage-tests;
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
doc = sagedoc;
lib = sage-with-env.env.lib;
kernelspec = jupyter-kernel-definition;
};
meta = with lib; {
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
homepage = "https://www.sagemath.org";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
};
}

View file

@ -0,0 +1,71 @@
{ stdenv
, sage-with-env
, python3
, jupyter-kernel-specs
}:
stdenv.mkDerivation rec {
version = src.version;
pname = "sagedoc";
src = sage-with-env.env.lib.src;
strictDeps = true;
unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
'';
buildPhase = ''
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
export HOME="$TMPDIR/sage_home"
mkdir -p "$HOME"
# needed to link them in the sage docs using intersphinx
export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
# adapted from src/doc/bootstrap (which we don't run)
OUTPUT_DIR="$SAGE_DOC_SRC_OVERRIDE/en/reference/repl"
mkdir -p "$OUTPUT_DIR"
OUTPUT="$OUTPUT_DIR/options.txt"
${sage-with-env}/bin/sage -advanced > "$OUTPUT"
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
export JUPYTER_PATH=${jupyter-kernel-specs}
# sage --docbuild unsets JUPYTER_PATH, so we call sage_docbuild directly
# https://trac.sagemath.org/ticket/33650#comment:32
${sage-with-env}/bin/sage --python3 -m sage_docbuild \
--mathjax \
--no-pdf-links \
all html < /dev/null
'';
installPhase = ''
cd "$SAGE_DOC_OVERRIDE"
mkdir -p "$out/share/doc/sage"
cp -r html "$out"/share/doc/sage
# Replace duplicated files by symlinks (Gentoo)
cd "$out"/share/doc/sage
mv html/en/_static{,.tmp}
for _dir in `find -name _static` ; do
rm -r $_dir
ln -rs html/en/_static $_dir
done
mv html/en/_static{.tmp,}
'';
doCheck = true;
checkPhase = ''
# sagemath_doc_html tests assume sage tests are being run, so we
# compromise: we run standard tests, but only on files containing
# relevant tests. as of Sage 9.6, there are only 4 such files.
grep -PRl "#.*optional.*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \
xargs ${sage-with-env}/bin/sage -t --optional=sage,sagemath_doc_html
'';
}

View file

@ -0,0 +1,213 @@
{ sage-src
, env-locations
, perl
, buildPythonPackage
, m4
, arb
, blas
, lapack
, brial
, cliquer
, cypari2
, cysignals
, cython
, lisp-compiler
, eclib
, ecm
, flint
, gd
, giac
, givaro
, glpk
, gsl
, iml
, jinja2
, lcalc
, lrcalc
, gap
, linbox
, m4ri
, m4rie
, memory-allocator
, libmpc
, mpfi
, ntl
, numpy
, pari
, pkgconfig # the python module, not the pkg-config alias
, pkg-config
, planarity
, ppl
, primecountpy
, python
, ratpoints
, readline
, rankwidth
, symmetrica
, zn_poly
, fflas-ffpack
, boost
, singular
, pip
, jupyter_core
, sage-setup
, libhomfly
, libbraiding
, gmpy2
, pplpy
, sqlite
, jupyter-client
, ipywidgets
, mpmath
, rpy2
, fpylll
, scipy
, sympy
, matplotlib
, pillow
, ipykernel
, networkx
, ptyprocess
, lrcalc-python
, sphinx # TODO: this is in setup.cfg, should we override it?
}:
assert (!blas.isILP64) && (!lapack.isILP64);
# This is the core sage python package. Everything else is just wrappers gluing
# stuff together. It is not very useful on its own though, since it will not
# find many of its dependencies without `sage-env`, will not be tested without
# `sage-tests` and will not have html docs without `sagedoc`.
buildPythonPackage rec {
version = src.version;
pname = "sagelib";
src = sage-src;
nativeBuildInputs = [
iml
perl
jupyter_core
pkg-config
sage-setup
pip # needed to query installed packages
lisp-compiler
m4
];
buildInputs = [
gd
readline
iml
];
propagatedBuildInputs = [
cypari2
jinja2
numpy
pkgconfig
boost
arb
brial
cliquer
lisp-compiler
eclib
ecm
fflas-ffpack
flint
giac
givaro
glpk
gsl
lcalc
gap
libmpc
linbox
lrcalc
m4ri
m4rie
memory-allocator
mpfi
ntl
blas
lapack
pari
planarity
ppl
primecountpy
rankwidth
ratpoints
singular
symmetrica
zn_poly
pip
cython
cysignals
libhomfly
libbraiding
gmpy2
pplpy
sqlite
mpmath
rpy2
scipy
sympy
matplotlib
pillow
ipykernel
fpylll
networkx
jupyter-client
ipywidgets
ptyprocess
lrcalc-python
sphinx
];
preBuild = ''
export SAGE_ROOT="$PWD"
export SAGE_LOCAL="$SAGE_ROOT"
export SAGE_SHARE="$SAGE_LOCAL/share"
# set locations of dependencies (needed for nbextensions like threejs)
. ${env-locations}/sage-env-locations
export JUPYTER_PATH="$SAGE_LOCAL/jupyter"
export PATH="$SAGE_ROOT/build/bin:$SAGE_ROOT/src/bin:$PATH"
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed"
cd build/pkgs/sagelib
# some files, like Pipfile, pyproject.toml, requirements.txt and setup.cfg
# are generated by the bootstrap script using m4. these can fetch data from
# build/pkgs, either directly or via sage-get-system-packages.
sed -i '/sage_conf/d' src/setup.cfg.m4
sed -i '/sage_conf/d' src/requirements.txt.m4
# version lower bounds are useful, but upper bounds are a hassle because
# Sage tests already catch any relevant API breakage.
# according to the discussion at https://trac.sagemath.org/ticket/33520,
# upper bounds will be less noisy starting from Sage 9.6.
sed -i 's/==0.5.1/>=0.5.1/' ../ptyprocess/install-requires.txt
sed -i 's/, <[^, ]*//' ../*/install-requires.txt
for infile in src/*.m4; do
if [ -f "$infile" ]; then
outfile="src/$(basename $infile .m4)"
m4 "$infile" > "$outfile"
fi
done
cd src
'';
postInstall = ''
rm -r "$out/${python.sitePackages}/sage/cython_debug"
'';
doCheck = false; # we will run tests in sage-tests.nix
}

View file

@ -0,0 +1,19 @@
{ stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "threejs-sage";
version = "r122";
src = fetchFromGitHub {
owner = "sagemath";
repo = "threejs-sage";
rev = version;
sha256 = "sha256-xPAPt36Fon3hYQq6SOmGkIyUzAII2LMl10nqYG4UPI0=";
};
installPhase = ''
mkdir -p "$out/lib/node_modules/three/"
cp version "$out/lib/node_modules/three"
cp -r build "$out/lib/node_modules/three/$(cat version)"
'';
}

Some files were not shown because too many files have changed in this diff Show more