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