1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 scikit-build-core,
6 nanobind,
7 cmake,
8 ninja,
9 pkg-config,
10 blas,
11 lapack,
12 numpy,
13 sympy,
14 scipy,
15 matplotlib,
16 fenics-ufl,
17 pytest-xdist,
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "fenics-basix";
23 version = "0.9.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "fenics";
28 repo = "basix";
29 tag = "v${version}";
30 hash = "sha256-jLQMDt6zdl+oixd5Qevn4bvxBsXpTNcbH2Os6TC9sRQ=";
31 };
32
33 dontUseCmakeConfigure = true;
34
35 build-system = [
36 scikit-build-core
37 nanobind
38 ];
39
40 nativeBuildInputs = [
41 cmake
42 ninja
43 pkg-config
44 ];
45
46 dependencies = [
47 numpy
48 ];
49
50 buildInputs = [
51 blas
52 lapack
53 ];
54
55 cmakeFlags = [
56 # Prefer finding BLAS and LAPACK via pkg-config.
57 # Avoid using the Accelerate.framework from the Darwin SDK.
58 # Also, avoid mistaking BLAS for LAPACK.
59 (lib.cmakeBool "BLA_PREFER_PKGCONFIG" true)
60 ];
61
62 pythonImportsCheck = [
63 "basix"
64 ];
65
66 nativeCheckInputs = [
67 sympy
68 scipy
69 matplotlib
70 fenics-ufl
71 pytest-xdist
72 pytestCheckHook
73 ];
74
75 meta = {
76 homepage = "https://fenicsproject.org";
77 downloadPage = "https://github.com/fenics/basix";
78 description = "Finite element definition and tabulation runtime library";
79 changelog = "https://github.com/fenics/basix/releases/tag/${src.tag}";
80 license = lib.licenses.mit;
81 maintainers = with lib.maintainers; [ qbisi ];
82 };
83}