summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/hoomd-blue/default.nix
blob: 056d326d93c3abc7d6877c3bfc870368d16db592 (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
61
62
63
64
65
66
67
68
69
70
{
  lib,
  buildPythonPackage,
  cmake,
  eigen,
  fetchFromGitHub,
  mpi,
  pkgconfig,
  python,
  # true or false to enable/disable; null to use upstream defaults
  withHpmc ? null,
  withMd ? null,
  withMetal ? null,
  withMpcd ? null,
}:

let
  optionalCmakeBool = name: value: lib.optionals (value != null) [ (lib.cmakeBool name value) ];
in
buildPythonPackage rec {
  version = "6.0.0";
  pname = "hoomd-blue";
  pyproject = false; # Built with cmake

  src = fetchFromGitHub {
    owner = "glotzerlab";
    repo = "hoomd-blue";
    tag = "v${version}";
    hash = "sha256-dmDBAJU6FxMQXuMO+nE1yzOY1m6/x43eH3USBQNVu8A=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    cmake
    pkgconfig
  ];
  buildInputs = [
    eigen
    mpi
  ];

  dependencies = with python.pkgs; [
    numpy
    mpi4py
    pybind11
  ];

  dontAddPrefix = true;
  cmakeFlags = [
    (lib.cmakeBool "BUILD_TESTING" doCheck)
    (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/${python.sitePackages}")
  ]
  ++ optionalCmakeBool "BUILD_MD" withMd
  ++ optionalCmakeBool "BUILD_HPMC" withHpmc
  ++ optionalCmakeBool "BUILD_METAL" withMetal
  ++ optionalCmakeBool "BUILD_MPCD" withMpcd;

  # Tests are performed as part of the installPhase when -DBUILD_TESTING=TRUE,
  # not the checkPhase or installCheckPhase.
  # But leave doCheck here so people can override it as they may expect.
  doCheck = true;

  meta = {
    homepage = "https://glotzerlab.engin.umich.edu/software/";
    description = "HOOMD-blue is a general-purpose particle simulation toolkit";
    changelog = "https://github.com/glotzerlab/hoomd-blue/blob/${src.tag}/CHANGELOG.rst";
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}