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