summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/cppe/default.nix
blob: 63c05e7998a7d6d6bc4161fda7e018b30aa2759b (plain)
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
{
  buildPythonPackage,
  lib,
  stdenv,
  cmake,
  cppe,
  eigen,
  pybind11,
  numpy,
  h5py,
  numba,
  scipy,
  pandas,
  polarizationsolver,
  pytest,
  llvmPackages,
}:

buildPythonPackage {
  inherit (cppe)
    pname
    version
    src
    meta
    ;

  # The python interface requires eigen3, but builds from a checkout in tree.
  # Using the nixpkgs version instead.
  postPatch = ''
    substituteInPlace setup.py \
      --replace "external/eigen3" "${eigen}/include/eigen3"
  '';

  nativeBuildInputs = [
    cmake
    eigen
  ];

  dontUseCmakeConfigure = true;

  format = "setuptools";

  buildInputs = [ pybind11 ] ++ lib.optional stdenv.cc.isClang llvmPackages.openmp;

  NIX_CFLAGS_LINK = lib.optional stdenv.cc.isClang "-lomp";

  hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";

  nativeCheckInputs = [
    pytest
    h5py
    numba
    numpy
    pandas
    polarizationsolver
    scipy
  ];

  pythonImportsCheck = [ "cppe" ];
}