bscpkgs/garlic/apps/nbody/default.nix

53 lines
887 B
Nix
Raw Normal View History

2020-09-21 20:34:08 +08:00
{
stdenv
, cc
, mpi ? null
, tampi ? null
, mcxx ? null
, cflags ? null
, gitBranch
2020-12-07 20:47:17 +08:00
, gitURL ? "ssh://git@bscpm03.bsc.es/garlic/apps/nbody.git"
2020-09-21 20:34:08 +08:00
, blocksize ? 2048
}:
assert !(tampi != null && mcxx == null);
with stdenv.lib;
stdenv.mkDerivation rec {
name = "nbody";
2020-10-07 15:49:42 +08:00
#src = ~/nbody;
2020-09-21 20:34:08 +08: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-04 01:06:51 +08:00
"CC=${cc.CC}"
2020-09-21 20:34:08 +08:00
"BS=${toString blocksize}"
]
++ optional (tampi != null) "TAMPI_HOME=${tampi}";
dontPatchShebangs = true;
installPhase = ''
echo ${tampi}
mkdir -p $out/bin
cp nbody* $out/bin/${name}
'';
}