Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.05 270 lines 6.9 kB view raw
1{ lib, stdenv 2, fetchurl 3, fetchpatch 4, blas 5, boost 6, cmake 7, doxygen 8, eigen 9, gtest 10, hdf5 11, lapack 12, mpi 13, mpi4py 14, numpy 15, pkg-config 16, ply 17, pybind11 18, pytest 19, python 20, pythonPackages 21, scotch 22, setuptools 23, six 24, sphinx 25, suitesparse 26, swig 27, sympy 28, zlib 29, nixosTests 30}: 31 32let 33 version = "2019.1.0"; 34 35 dijitso = pythonPackages.buildPythonPackage { 36 pname = "dijitso"; 37 inherit version; 38 src = fetchurl { 39 url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz"; 40 sha256 = "1ncgbr0bn5cvv16f13g722a0ipw6p9y6p4iasxjziwsp8kn5x97a"; 41 }; 42 propagatedBuildInputs = [ numpy six ]; 43 nativeCheckInputs = [ pytest ]; 44 preCheck = '' 45 export HOME=$PWD 46 ''; 47 checkPhase = '' 48 runHook preCheck 49 py.test test/ 50 runHook postCheck 51 ''; 52 meta = { 53 description = "Distributed just-in-time shared library building"; 54 homepage = "https://fenicsproject.org/"; 55 platforms = lib.platforms.all; 56 license = lib.licenses.lgpl3; 57 }; 58 }; 59 60 fiat = pythonPackages.buildPythonPackage { 61 pname = "fiat"; 62 inherit version; 63 src = fetchurl { 64 url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz"; 65 sha256 = "1sbi0fbr7w9g9ajr565g3njxrc3qydqjy3334vmz5xg0rd3106il"; 66 }; 67 propagatedBuildInputs = [ numpy six sympy ]; 68 nativeCheckInputs = [ pytest ]; 69 70 preCheck = '' 71 # Workaround pytest 4.6.3 issue. 72 # See: https://bitbucket.org/fenics-project/fiat/pull-requests/59 73 rm test/unit/test_quadrature.py 74 rm test/unit/test_reference_element.py 75 rm test/unit/test_fiat.py 76 77 # Fix `np.float` deprecation in Numpy 1.20 78 grep -lr 'np.float(' test/ | while read -r fn; do 79 substituteInPlace "$fn" \ 80 --replace "np.float(" "np.float64(" 81 done 82 ''; 83 checkPhase = '' 84 runHook preCheck 85 py.test test/unit/ 86 runHook postCheck 87 ''; 88 meta = { 89 description = "Automatic generation of finite element basis functions"; 90 homepage = "https://fenicsproject.org/"; 91 platforms = lib.platforms.all; 92 license = lib.licenses.lgpl3; 93 }; 94 }; 95 96 ufl = pythonPackages.buildPythonPackage { 97 pname = "ufl"; 98 inherit version; 99 src = fetchurl { 100 url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz"; 101 sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1"; 102 }; 103 propagatedBuildInputs = [ numpy six ]; 104 nativeCheckInputs = [ pytest ]; 105 checkPhase = '' 106 runHook preCheck 107 py.test test/ 108 runHook postCheck 109 ''; 110 meta = { 111 description = "A domain-specific language for finite element variational forms"; 112 homepage = "https://fenicsproject.org/"; 113 platforms = lib.platforms.all; 114 license = lib.licenses.lgpl3; 115 }; 116 }; 117 118 ffc = pythonPackages.buildPythonPackage { 119 pname = "ffc"; 120 inherit version; 121 src = fetchurl { 122 url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz"; 123 sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g"; 124 }; 125 nativeBuildInputs = [ 126 pybind11 127 ]; 128 propagatedBuildInputs = [ 129 dijitso 130 fiat 131 numpy 132 six 133 sympy 134 ufl 135 setuptools 136 ]; 137 nativeCheckInputs = [ pytest ]; 138 preCheck = '' 139 export HOME=$PWD 140 rm test/unit/ufc/finite_element/test_evaluate.py 141 ''; 142 checkPhase = '' 143 runHook preCheck 144 py.test test/unit/ 145 runHook postCheck 146 ''; 147 meta = { 148 description = "A compiler for finite element variational forms"; 149 homepage = "https://fenicsproject.org/"; 150 platforms = lib.platforms.all; 151 license = lib.licenses.lgpl3; 152 }; 153 }; 154 dolfin = stdenv.mkDerivation { 155 pname = "dolfin"; 156 inherit version; 157 src = fetchurl { 158 url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz"; 159 sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33"; 160 }; 161 patches = [ 162 (fetchpatch { 163 name = "fix-double-prefix.patch"; 164 url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw"; 165 sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r"; 166 }) 167 ]; 168 propagatedBuildInputs = [ 169 dijitso 170 fiat 171 numpy 172 six 173 ufl 174 ]; 175 nativeBuildInputs = [ 176 cmake 177 doxygen 178 pkg-config 179 ]; 180 buildInputs = [ 181 boost 182 dijitso 183 eigen 184 ffc 185 fiat 186 hdf5 187 mpi 188 numpy 189 blas 190 lapack 191 ply 192 python 193 scotch 194 six 195 sphinx 196 suitesparse 197 swig 198 sympy 199 ufl 200 zlib 201 ]; 202 cmakeFlags = [ 203 "-DDOLFIN_CXX_FLAGS=-std=c++11" 204 "-DDOLFIN_AUTO_DETECT_MPI=ON" 205 "-DDOLFIN_ENABLE_CHOLMOD=ON" 206 "-DDOLFIN_ENABLE_DOCS=ON" 207 "-DDOLFIN_ENABLE_HDF5=ON" 208 "-DDOLFIN_ENABLE_MPI=ON" 209 "-DDOLFIN_ENABLE_SCOTCH=ON" 210 "-DDOLFIN_ENABLE_UMFPACK=ON" 211 "-DDOLFIN_ENABLE_ZLIB=ON" 212 "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found 213 # TODO: Enable the following features 214 "-DDOLFIN_ENABLE_PARMETIS=OFF" 215 "-DDOLFIN_ENABLE_PETSC=OFF" 216 "-DDOLFIN_ENABLE_SLEPC=OFF" 217 "-DDOLFIN_ENABLE_TRILINOS=OFF" 218 ]; 219 installCheckPhase = '' 220 source $out/share/dolfin/dolfin.conf 221 make runtests 222 ''; 223 meta = { 224 description = "The FEniCS Problem Solving Environment in Python and C++"; 225 homepage = "https://fenicsproject.org/"; 226 license = lib.licenses.lgpl3; 227 }; 228 }; 229 python-dolfin = pythonPackages.buildPythonPackage rec { 230 pname = "dolfin"; 231 inherit version; 232 disabled = pythonPackages.isPy27; 233 src = dolfin.src; 234 sourceRoot = "${pname}-${version}/python"; 235 nativeBuildInputs = [ 236 pybind11 237 cmake 238 ]; 239 dontUseCmakeConfigure = true; 240 preConfigure = '' 241 export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH 242 substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11" 243 substituteInPlace dolfin/jit/jit.py \ 244 --replace 'pkgconfig.exists("dolfin")' 'pkgconfig.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \ 245 --replace 'pkgconfig.parse("dolfin")' 'pkgconfig.parse("${dolfin}/lib/pkgconfig/dolfin.pc")' 246 ''; 247 buildInputs = [ 248 dolfin 249 boost 250 ]; 251 252 propagatedBuildInputs = [ 253 dijitso 254 ffc 255 mpi4py 256 numpy 257 ufl 258 pythonPackages.pkgconfig 259 pythonPackages.pybind11 260 ]; 261 doCheck = false; # Tries to orte_ess_init and call ssh to localhost 262 passthru.tests = { inherit (nixosTests) fenics; }; 263 meta = { 264 description = "Python bindings for the DOLFIN FEM compiler"; 265 homepage = "https://fenicsproject.org/"; 266 platforms = lib.platforms.all; 267 license = lib.licenses.lgpl3; 268 }; 269 }; 270in python-dolfin