forked from rarias/bscpkgs
Testing experiments with nbody
This commit is contained in:
44
bsc/garlic/nbody/default.nix
Normal file
44
bsc/garlic/nbody/default.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
stdenv
|
||||
, cc
|
||||
, cflags ? null
|
||||
, gitBranch
|
||||
, blocksize ? "2048"
|
||||
, particles ? "16384"
|
||||
, timesteps ? "10"
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "nbody";
|
||||
|
||||
src = builtins.fetchGit {
|
||||
url = "ssh://git@bscpm02.bsc.es/rarias/nbody.git";
|
||||
ref = gitBranch;
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
cc
|
||||
];
|
||||
|
||||
preBuild = (if cflags != null then ''
|
||||
makeFlagsArray+=(CFLAGS=${cflags})
|
||||
'' else "");
|
||||
|
||||
makeFlags = [
|
||||
"CC=${cc.cc.CC}"
|
||||
"BS=${blocksize}"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp nbody $out/bin/
|
||||
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/bash
|
||||
exec $out/bin/nbody -p ${particles} -t ${timesteps}
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/run
|
||||
'';
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user