bscpkgs/garlic/stages/control.nix
Rodrigo Arias Mallo 7d4db6b6de control: Exit on error
This prevents srun from silently returning with an error, without
actually queueing the job of a run.
2020-12-07 16:33:40 +01:00

34 lines
545 B
Nix

{
stdenv
, garlicTools
}:
{
nextStage
, loops ? 30
}:
with garlicTools;
stdenv.mkDerivation {
name = "control";
preferLocalBuild = true;
phases = [ "installPhase" ];
dontPatchShebangs = true;
installPhase = ''
cat > $out <<EOF
#!/bin/sh -e
for n in \$(seq 1 ${toString loops}); do
export GARLIC_RUN="\$n"
echo "running \$n of ${toString loops}" > status
mkdir "\$n"
cd "\$n"
${stageProgram nextStage}
cd ..
done
echo "completed" > status
EOF
chmod +x $out
'';
}