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 checkInputs = [ 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 checkInputs = [ 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 checkPhase = ''
78 runHook preCheck
79 py.test test/unit/
80 runHook postCheck
81 '';
82 meta = {
83 description = "Automatic generation of finite element basis functions";
84 homepage = "https://fenicsproject.org/";
85 platforms = lib.platforms.all;
86 license = lib.licenses.lgpl3;
87 };
88 };
89
90 ufl = pythonPackages.buildPythonPackage {
91 pname = "ufl";
92 inherit version;
93 src = fetchurl {
94 url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz";
95 sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1";
96 };
97 propagatedBuildInputs = [ numpy six ];
98 checkInputs = [ pytest ];
99 checkPhase = ''
100 runHook preCheck
101 py.test test/
102 runHook postCheck
103 '';
104 meta = {
105 description = "A domain-specific language for finite element variational forms";
106 homepage = "https://fenicsproject.org/";
107 platforms = lib.platforms.all;
108 license = lib.licenses.lgpl3;
109 };
110 };
111
112 ffc = pythonPackages.buildPythonPackage {
113 pname = "ffc";
114 inherit version;
115 src = fetchurl {
116 url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz";
117 sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g";
118 };
119 nativeBuildInputs = [
120 pybind11
121 ];
122 propagatedBuildInputs = [
123 dijitso
124 fiat
125 numpy
126 six
127 sympy
128 ufl
129 setuptools
130 ];
131 checkInputs = [ pytest ];
132 preCheck = ''
133 export HOME=$PWD
134 rm test/unit/ufc/finite_element/test_evaluate.py
135 '';
136 checkPhase = ''
137 runHook preCheck
138 py.test test/unit/
139 runHook postCheck
140 '';
141 meta = {
142 description = "A compiler for finite element variational forms";
143 homepage = "https://fenicsproject.org/";
144 platforms = lib.platforms.all;
145 license = lib.licenses.lgpl3;
146 };
147 };
148 dolfin = stdenv.mkDerivation {
149 pname = "dolfin";
150 inherit version;
151 src = fetchurl {
152 url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz";
153 sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33";
154 };
155 patches = [
156 (fetchpatch {
157 name = "fix-double-prefix.patch";
158 url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw";
159 sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r";
160 })
161 ];
162 propagatedBuildInputs = [
163 dijitso
164 fiat
165 numpy
166 six
167 ufl
168 ];
169 nativeBuildInputs = [
170 cmake
171 doxygen
172 pkg-config
173 ];
174 buildInputs = [
175 boost
176 dijitso
177 eigen
178 ffc
179 fiat
180 hdf5
181 mpi
182 numpy
183 blas
184 lapack
185 ply
186 python
187 scotch
188 six
189 sphinx
190 suitesparse
191 swig
192 sympy
193 ufl
194 zlib
195 ];
196 cmakeFlags = [
197 "-DDOLFIN_CXX_FLAGS=-std=c++11"
198 "-DDOLFIN_AUTO_DETECT_MPI=ON"
199 "-DDOLFIN_ENABLE_CHOLMOD=ON"
200 "-DDOLFIN_ENABLE_DOCS=ON"
201 "-DDOLFIN_ENABLE_HDF5=ON"
202 "-DDOLFIN_ENABLE_MPI=ON"
203 "-DDOLFIN_ENABLE_SCOTCH=ON"
204 "-DDOLFIN_ENABLE_UMFPACK=ON"
205 "-DDOLFIN_ENABLE_ZLIB=ON"
206 "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found
207 # TODO: Enable the following features
208 "-DDOLFIN_ENABLE_PARMETIS=OFF"
209 "-DDOLFIN_ENABLE_PETSC=OFF"
210 "-DDOLFIN_ENABLE_SLEPC=OFF"
211 "-DDOLFIN_ENABLE_TRILINOS=OFF"
212 ];
213 installCheckPhase = ''
214 source $out/share/dolfin/dolfin.conf
215 make runtests
216 '';
217 meta = {
218 description = "The FEniCS Problem Solving Environment in Python and C++";
219 homepage = "https://fenicsproject.org/";
220 license = lib.licenses.lgpl3;
221 };
222 };
223 python-dolfin = pythonPackages.buildPythonPackage rec {
224 pname = "dolfin";
225 inherit version;
226 disabled = pythonPackages.isPy27;
227 src = dolfin.src;
228 sourceRoot = "${pname}-${version}/python";
229 nativeBuildInputs = [
230 pybind11
231 cmake
232 ];
233 dontUseCmakeConfigure = true;
234 preConfigure = ''
235 export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH
236 substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11"
237 substituteInPlace dolfin/jit/jit.py \
238 --replace 'pkgconfig.exists("dolfin")' 'pkgconfig.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \
239 --replace 'pkgconfig.parse("dolfin")' 'pkgconfig.parse("${dolfin}/lib/pkgconfig/dolfin.pc")'
240 '';
241 buildInputs = [
242 dolfin
243 boost
244 ];
245
246 propagatedBuildInputs = [
247 dijitso
248 ffc
249 mpi4py
250 numpy
251 ufl
252 pythonPackages.pkgconfig
253 pythonPackages.pybind11
254 ];
255 doCheck = false; # Tries to orte_ess_init and call ssh to localhost
256 passthru.tests = { inherit (nixosTests) fenics; };
257 meta = {
258 description = "Python bindings for the DOLFIN FEM compiler";
259 homepage = "https://fenicsproject.org/";
260 platforms = lib.platforms.all;
261 license = lib.licenses.lgpl3;
262 };
263 };
264in python-dolfin