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