2020-09-21 14:34:08 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, cc
|
|
|
|
, mpi ? null
|
|
|
|
, tampi ? null
|
|
|
|
, mcxx ? null
|
|
|
|
, cflags ? null
|
|
|
|
, gitBranch
|
2020-12-07 13:47:17 +01:00
|
|
|
, gitURL ? "ssh://git@bscpm03.bsc.es/garlic/apps/nbody.git"
|
2020-09-21 14:34:08 +02:00
|
|
|
, blocksize ? 2048
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert !(tampi != null && mcxx == null);
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "nbody";
|
|
|
|
|
2020-10-07 09:49:42 +02:00
|
|
|
#src = ~/nbody;
|
2020-09-21 14:34:08 +02:00
|
|
|
|
|
|
|
src = builtins.fetchGit {
|
|
|
|
url = "${gitURL}";
|
|
|
|
ref = "${gitBranch}";
|
|
|
|
};
|
|
|
|
programPath = "/bin/nbody";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
cc
|
|
|
|
]
|
|
|
|
++ optional (mpi != null) mpi
|
|
|
|
++ optional (tampi != null) tampi
|
|
|
|
++ optional (mcxx != null) mcxx;
|
|
|
|
|
|
|
|
preBuild = (if cflags != null then ''
|
|
|
|
makeFlagsArray+=(CFLAGS="${cflags}")
|
|
|
|
'' else "");
|
|
|
|
|
|
|
|
makeFlags = [
|
2020-12-03 18:06:51 +01:00
|
|
|
"CC=${cc.CC}"
|
2020-09-21 14:34:08 +02:00
|
|
|
"BS=${toString blocksize}"
|
|
|
|
]
|
|
|
|
++ optional (tampi != null) "TAMPI_HOME=${tampi}";
|
|
|
|
|
|
|
|
dontPatchShebangs = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
echo ${tampi}
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp nbody* $out/bin/${name}
|
|
|
|
'';
|
|
|
|
|
|
|
|
}
|