forked from rarias/bscpkgs
Provide argvWrapper
This commit is contained in:
29
bsc/garlic/nbody/argv.nix
Normal file
29
bsc/garlic/nbody/argv.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
stdenv
|
||||
, particles
|
||||
, timestamps
|
||||
, program
|
||||
, config
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit program;
|
||||
|
||||
passthru = {
|
||||
inherit config;
|
||||
};
|
||||
|
||||
name = "${program.name}-argv";
|
||||
preferLocalBuild = true;
|
||||
phases = [ "installPhase" ];
|
||||
dontPatchShebangs = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/sh
|
||||
exec ${program}/bin/run -p ${toString config.particles} -t ${toString config.timesteps}
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/run
|
||||
'';
|
||||
}
|
||||
@@ -4,16 +4,14 @@
|
||||
, cflags ? null
|
||||
, gitBranch
|
||||
, blocksize ? 2048
|
||||
, particles ? 16384
|
||||
, timesteps ? 10
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation rec {
|
||||
name = "nbody";
|
||||
|
||||
src = builtins.fetchGit {
|
||||
url = "ssh://git@bscpm02.bsc.es/rarias/nbody.git";
|
||||
ref = gitBranch;
|
||||
ref = "${gitBranch}";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
@@ -33,15 +31,8 @@ stdenv.mkDerivation {
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp nbody $out/bin/
|
||||
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/sh
|
||||
|
||||
exec $out/bin/nbody -p ${toString particles} -t ${toString timesteps}
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/run
|
||||
cp nbody* $out/bin/${name}
|
||||
ln -s $out/bin/${name} $out/bin/run
|
||||
'';
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user