nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 186 lines 3.5 kB view raw
1{ 2 lib, 3 newScope, 4 stdenv, 5 buildPythonPackage, 6 fetchFromGitHub, 7 python, 8 9 # build-system 10 setuptools, 11 cython, 12 pybind11, 13 14 # dependencies 15 decorator, 16 cachetools, 17 mpi4py, 18 fenics-ufl, 19 firedrake-fiat, 20 h5py, 21 libsupermesh, 22 loopy, 23 petsc4py, 24 petsctools, 25 numpy, 26 packaging, 27 pkgconfig, 28 progress, 29 pyadjoint-ad, 30 pycparser, 31 pytools, 32 requests, 33 rtree, 34 scipy, 35 sympy, 36 islpy, 37 vtk, 38 matplotlib, 39 immutabledict, 40 41 # tests 42 pytest, 43 mpi-pytest, 44 mpiCheckPhaseHook, 45 writableTmpDirAsHomeHook, 46 47 # passthru 48 firedrake, 49 mpich, 50 nix-update-script, 51}: 52let 53 firedrakePackages = lib.makeScope newScope (self: { 54 inherit (petsc4py.petscPackages) mpi hdf5; 55 mpi4py = self.callPackage mpi4py.override { }; 56 h5py = self.callPackage h5py.override { }; 57 mpi-pytest = self.callPackage mpi-pytest.override { }; 58 }); 59in 60buildPythonPackage (finalAttrs: { 61 pname = "firedrake"; 62 version = "2025.10.2"; 63 pyproject = true; 64 65 src = fetchFromGitHub { 66 owner = "firedrakeproject"; 67 repo = "firedrake"; 68 tag = finalAttrs.version; 69 hash = "sha256-A0dr9A1fm74IzpYiVxzdo4jtELYH7JBeRMOD9uYJODQ="; 70 }; 71 72 # relax build-dependency petsc4py 73 postPatch = '' 74 substituteInPlace pyproject.toml --replace-fail \ 75 "petsc4py==3.24.0" "petsc4py" 76 ''; 77 78 pythonRelaxDeps = [ 79 "decorator" 80 ]; 81 82 build-system = [ 83 cython 84 libsupermesh 85 firedrakePackages.mpi4py 86 numpy 87 pkgconfig 88 pybind11 89 setuptools 90 petsc4py 91 rtree 92 ]; 93 94 nativeBuildInputs = [ 95 firedrakePackages.mpi 96 ]; 97 98 dependencies = [ 99 decorator 100 cachetools 101 firedrakePackages.mpi4py 102 fenics-ufl 103 firedrake-fiat 104 firedrakePackages.h5py 105 immutabledict 106 libsupermesh 107 loopy 108 petsc4py 109 petsctools 110 numpy 111 packaging 112 pkgconfig 113 progress 114 pyadjoint-ad 115 pycparser 116 pytools 117 requests 118 rtree 119 scipy 120 sympy 121 # vtk optional required by IO module, we can make it a hard dependency in nixpkgs, 122 # see https://github.com/firedrakeproject/firedrake/pull/4713 123 vtk 124 # required by script spydump 125 matplotlib 126 ] 127 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 128 islpy 129 ]; 130 131 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' 132 install_name_tool -add_rpath ${libsupermesh}/${python.sitePackages}/libsupermesh/lib \ 133 $out/${python.sitePackages}/firedrake/cython/supermeshimpl.cpython-*-darwin.so 134 ''; 135 136 doCheck = true; 137 138 __darwinAllowLocalNetworking = true; 139 140 pythonImportsCheck = [ "firedrake" ]; 141 142 nativeCheckInputs = [ 143 pytest 144 firedrakePackages.mpi-pytest 145 mpiCheckPhaseHook 146 writableTmpDirAsHomeHook 147 ]; 148 149 # run official smoke tests 150 checkPhase = '' 151 runHook preCheck 152 153 $out/bin/firedrake-check 154 155 runHook postCheck 156 ''; 157 158 passthru = { 159 # python updater script sets the wrong tag 160 skipBulkUpdate = true; 161 162 updateScript = nix-update-script { 163 extraArgs = [ 164 "--version-regex" 165 "([0-9.]+)" 166 ]; 167 }; 168 169 tests = lib.optionalAttrs stdenv.hostPlatform.isLinux { 170 mpich = firedrake.override { 171 petsc4py = petsc4py.override { mpi = mpich; }; 172 }; 173 }; 174 }; 175 176 meta = { 177 homepage = "https://www.firedrakeproject.org"; 178 downloadPage = "https://github.com/firedrakeproject/firedrake"; 179 description = "Automated Finite Element System"; 180 license = with lib.licenses; [ 181 bsd3 182 lgpl3Plus 183 ]; 184 maintainers = with lib.maintainers; [ qbisi ]; 185 }; 186})