Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 196 lines 4.1 kB view raw
1{ 2 lib, 3 newScope, 4 stdenv, 5 buildPythonPackage, 6 fetchFromGitHub, 7 fetchpatch2, 8 python, 9 pax-utils, 10 11 # build-system 12 setuptools, 13 cython, 14 pybind11, 15 16 # dependencies 17 decorator, 18 cachetools, 19 mpi4py, 20 fenics-ufl, 21 firedrake-fiat, 22 h5py, 23 libsupermesh, 24 loopy, 25 petsc4py, 26 numpy, 27 packaging, 28 pkgconfig, 29 progress, 30 pyadjoint-ad, 31 pycparser, 32 pytools, 33 requests, 34 rtree, 35 scipy, 36 sympy, 37 islpy, 38 matplotlib, 39 40 # tests 41 pytest, 42 mpi-pytest, 43 mpiCheckPhaseHook, 44 writableTmpDirAsHomeHook, 45 46 # passthru.tests 47 firedrake, 48 mpich, 49}: 50let 51 firedrakePackages = lib.makeScope newScope (self: { 52 inherit (petsc4py.petscPackages) mpi hdf5; 53 mpi4py = self.callPackage mpi4py.override { }; 54 h5py = self.callPackage h5py.override { }; 55 mpi-pytest = self.callPackage mpi-pytest.override { }; 56 }); 57in 58buildPythonPackage rec { 59 pname = "firedrake"; 60 version = "2025.4.0.post0"; 61 pyproject = true; 62 63 src = fetchFromGitHub { 64 owner = "firedrakeproject"; 65 repo = "firedrake"; 66 tag = version; 67 hash = "sha256-wQOS4v/YkIwXdQq6JMvRbmyhnzvx6wj0O6aszNa5ZMw="; 68 }; 69 70 patches = [ 71 (fetchpatch2 { 72 url = "https://github.com/firedrakeproject/firedrake/commit/b358e33ab12b3c4bc3819c9c6e9ed0930082b750.patch?full_index=1"; 73 hash = "sha256-y00GB8njhmHgtAVvlv8ImsJe+hMCU1QFtbB8llEhv/I="; 74 }) 75 ]; 76 77 postPatch = 78 '' 79 # relax build-dependency petsc4py 80 substituteInPlace pyproject.toml --replace-fail \ 81 "petsc4py==3.23.0" "petsc4py" 82 83 # These scripts are used by official source distribution only, 84 # and do not make sense in our binary distribution. 85 sed -i '/firedrake-\(check\|status\|run-split-tests\)/d' pyproject.toml 86 '' 87 + lib.optionalString stdenv.hostPlatform.isLinux '' 88 substituteInPlace firedrake/petsc.py --replace-fail \ 89 'program = ["ldd"]' \ 90 'program = ["${lib.getExe' pax-utils "lddtree"}"]' 91 '' 92 + lib.optionalString stdenv.hostPlatform.isDarwin '' 93 substituteInPlace firedrake/petsc.py --replace-fail \ 94 'program = ["otool"' \ 95 'program = ["${lib.getExe' stdenv.cc.bintools.bintools "otool"}"' 96 ''; 97 98 pythonRelaxDeps = [ 99 "decorator" 100 ]; 101 102 build-system = [ 103 cython 104 libsupermesh 105 firedrakePackages.mpi4py 106 numpy 107 pkgconfig 108 pybind11 109 setuptools 110 petsc4py 111 rtree 112 ]; 113 114 nativeBuildInputs = [ 115 firedrakePackages.mpi 116 ]; 117 118 dependencies = 119 [ 120 decorator 121 cachetools 122 firedrakePackages.mpi4py 123 fenics-ufl 124 firedrake-fiat 125 firedrakePackages.h5py 126 libsupermesh 127 loopy 128 petsc4py 129 numpy 130 packaging 131 pkgconfig 132 progress 133 pyadjoint-ad 134 pycparser 135 pytools 136 requests 137 rtree 138 scipy 139 sympy 140 # required by script spydump 141 matplotlib 142 ] 143 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 144 islpy 145 ]; 146 147 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' 148 install_name_tool -add_rpath ${libsupermesh}/${python.sitePackages}/libsupermesh/lib \ 149 $out/${python.sitePackages}/firedrake/cython/supermeshimpl.cpython-*-darwin.so 150 ''; 151 152 doCheck = true; 153 154 __darwinAllowLocalNetworking = true; 155 156 pythonImportsCheck = [ "firedrake" ]; 157 158 nativeCheckInputs = [ 159 pytest 160 firedrakePackages.mpi-pytest 161 mpiCheckPhaseHook 162 writableTmpDirAsHomeHook 163 ]; 164 165 preCheck = '' 166 rm -rf firedrake pyop2 tinyasm tsfc 167 ''; 168 169 # run official smoke tests 170 checkPhase = '' 171 runHook preCheck 172 173 make check 174 175 runHook postCheck 176 ''; 177 178 passthru = { 179 tests = lib.optionalAttrs stdenv.hostPlatform.isLinux { 180 mpich = firedrake.override { 181 petsc4py = petsc4py.override { mpi = mpich; }; 182 }; 183 }; 184 }; 185 186 meta = { 187 homepage = "https://www.firedrakeproject.org"; 188 downloadPage = "https://github.com/firedrakeproject/firedrake"; 189 description = "Automated Finite Element System"; 190 license = with lib.licenses; [ 191 bsd3 192 lgpl3Plus 193 ]; 194 maintainers = with lib.maintainers; [ qbisi ]; 195 }; 196}