bscpkgs/bsc/garlic/nbody/default.nix

43 lines
674 B
Nix
Raw Normal View History

2020-07-27 23:55:56 +08:00
{
stdenv
, cc
2020-08-18 00:50:18 +08:00
, mpi ? null
2020-07-27 23:55:56 +08:00
, cflags ? null
, gitBranch
2020-08-26 00:37:50 +08:00
, gitURL ? "ssh://git@bscpm02.bsc.es/garlic/apps/nbody.git"
2020-08-05 00:38:33 +08:00
, blocksize ? 2048
2020-07-27 23:55:56 +08:00
}:
2020-08-18 00:50:18 +08:00
with stdenv.lib;
2020-08-12 20:00:04 +08:00
stdenv.mkDerivation rec {
2020-07-27 23:55:56 +08:00
name = "nbody";
src = builtins.fetchGit {
2020-08-18 00:50:18 +08:00
url = "${gitURL}";
2020-08-12 20:00:04 +08:00
ref = "${gitBranch}";
2020-07-27 23:55:56 +08:00
};
buildInputs = [
cc
2020-08-18 00:50:18 +08:00
]
++ optional (mpi != null) [ mpi ];
2020-07-27 23:55:56 +08:00
preBuild = (if cflags != null then ''
2020-07-28 01:13:11 +08:00
makeFlagsArray+=(CFLAGS="${cflags}")
2020-07-27 23:55:56 +08:00
'' else "");
makeFlags = [
"CC=${cc.cc.CC}"
2020-08-05 00:38:33 +08:00
"BS=${toString blocksize}"
2020-07-27 23:55:56 +08:00
];
dontPatchShebangs = true;
2020-07-27 23:55:56 +08:00
installPhase = ''
mkdir -p $out/bin
2020-08-12 20:00:04 +08:00
cp nbody* $out/bin/${name}
ln -s $out/bin/${name} $out/bin/run
2020-07-27 23:55:56 +08:00
'';
}