1{ lib, stdenv, fetchgit
2, cmake, pkgconfig
3, python
4, mpi ? null
5}:
6
7let components = {
8 cgcmm = true;
9 depreciated = true;
10 hpmc = true;
11 md = true;
12 metal = true;
13 };
14 onOffBool = b: if b then "ON" else "OFF";
15 withMPI = (mpi != null);
16in
17stdenv.mkDerivation rec {
18 version = "2.3.4";
19 pname = "hoomd-blue";
20
21 src = fetchgit {
22 url = "https://bitbucket.org/glotzer/hoomd-blue";
23 rev = "v${version}";
24 sha256 = "0in49f1dvah33nl5n2qqbssfynb31pw1ds07j8ziryk9w252j1al";
25 };
26
27 passthru = {
28 inherit components mpi;
29 };
30
31 nativeBuildInputs = [ cmake pkgconfig ];
32 buildInputs = lib.optionals withMPI [ mpi ];
33 propagatedBuildInputs = [ python.pkgs.numpy ]
34 ++ lib.optionals withMPI [ python.pkgs.mpi4py ];
35
36 dontAddPrefix = true;
37 cmakeFlags = [
38 "-DENABLE_MPI=${onOffBool withMPI}"
39 "-DBUILD_CGCMM=${onOffBool components.cgcmm}"
40 "-DBUILD_DEPRECIATED=${onOffBool components.depreciated}"
41 "-DBUILD_HPMC=${onOffBool components.hpmc}"
42 "-DBUILD_MD=${onOffBool components.md}"
43 "-DBUILD_METAL=${onOffBool components.metal}"
44 ];
45
46 preConfigure = ''
47 # Since we can't expand $out in `cmakeFlags`
48 cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_PREFIX=$out/${python.sitePackages}"
49 '';
50
51 # tests fail but have tested that package runs properly
52 doCheck = false;
53 checkTarget = "test";
54
55 meta = with lib; {
56 homepage = "http://glotzerlab.engin.umich.edu/hoomd-blue/";
57 description = "HOOMD-blue is a general-purpose particle simulation toolkit";
58 license = licenses.bsdOriginal;
59 platforms = [ "x86_64-linux" ];
60 maintainers = [ maintainers.costrouc ];
61 };
62
63}