bscpkgs/garlic/apps/nbody/default.nix

59 lines
1.0 KiB
Nix
Raw Normal View History

2020-09-21 14:34:08 +02:00
{
stdenv
, cc
, mpi ? null
, tampi ? null
, mcxx ? null
, cflags ? null
2021-04-20 17:47:22 +02:00
, gitBranch ? "garlic/seq"
, gitCommit ? null
2020-09-21 14:34:08 +02:00
, blocksize ? 2048
2021-04-20 17:47:22 +02:00
, garlicTools
2020-09-21 14:34:08 +02:00
}:
assert !(tampi != null && mcxx == null);
with stdenv.lib;
2021-04-20 17:47:22 +02:00
let
gitSource = garlicTools.fetchGarlicApp {
appName = "nbody";
inherit gitCommit gitBranch;
gitTable = import ./git-table.nix;
2020-09-21 14:34:08 +02:00
};
2021-04-20 17:47:22 +02:00
in
stdenv.mkDerivation rec {
name = "nbody";
inherit (gitSource) src gitBranch gitCommit;
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 = [
"CC=${cc.CC}"
"BS=${toString blocksize}"
]
++ optional (tampi != null) "TAMPI_HOME=${tampi}";
dontPatchShebangs = true;
installPhase = ''
echo ${tampi}
mkdir -p $out/bin
cp nbody* $out/bin/${name}
'';
hardeningDisable = [ "all" ];
2021-04-20 17:47:22 +02:00
}