about summary refs log tree commit diff
path: root/pkgs/development/libraries/science/chemistry/tblite/python.nix
blob: cfe8668204e2758e7ceb12063102ca836cdaf4a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, buildPythonPackage
, pythonAtLeast
, fetchpatch
, meson
, ninja
, pkg-config
, tblite
, numpy
, simple-dftd3
, cffi
, gfortran
, blas
, lapack
, mctc-lib
, mstore
, toml-f
, multicharge
, dftd4
, setuptools
}:

buildPythonPackage {
  inherit (tblite) pname version src meta;

  nativeBuildInputs = [
    tblite
    meson
    ninja
    pkg-config
    gfortran
    mctc-lib
  ] ++ lib.optionals (pythonAtLeast "3.12") [
    setuptools
  ];

  buildInputs = [
    tblite
    simple-dftd3
    blas
    lapack
    mctc-lib
    mstore
    toml-f
    multicharge
    dftd4
  ];

  propagatedBuildInputs = [ tblite simple-dftd3 cffi numpy ];


  patches = [
    # Add multicharge to the meson deps; otherwise we get missing mod_multicharge errors
    ./0001-fix-multicharge-dep-needed-for-static-compilation.patch

    # Toml-f 0.4.0 compatibility https://github.com/tblite/tblite/pull/108
    (fetchpatch {
      url = "https://github.com/tblite/tblite/commit/e4255519b58a5198a5fa8f3073bef1c78a4bbdbe.diff";
      hash = "sha256-BMwYsdWfK+vG3BFgzusLYfwo0WXrYSPxJoEJIyOvbPg=";
    })
  ];

  format = "other";
  pythonImportsCheck = [ "tblite" "tblite.interface" ];
  mesonFlags = [ "-Dpython=true" ];
}