2020-08-11 18:05:43 +08:00
|
|
|
{
|
|
|
|
stdenv
|
2020-10-09 21:55:37 +08:00
|
|
|
, garlicTools
|
2020-08-11 18:05:43 +08:00
|
|
|
}:
|
|
|
|
|
2020-09-02 23:07:09 +08:00
|
|
|
{
|
2020-10-09 21:55:37 +08:00
|
|
|
nextStage
|
2020-09-03 22:18:50 +08:00
|
|
|
, loops ? 30
|
2020-09-02 23:07:09 +08:00
|
|
|
}:
|
2020-08-11 18:05:43 +08:00
|
|
|
|
2020-10-09 21:55:37 +08:00
|
|
|
with garlicTools;
|
|
|
|
|
2020-08-11 18:05:43 +08:00
|
|
|
stdenv.mkDerivation {
|
2020-09-02 23:07:09 +08:00
|
|
|
name = "control";
|
2020-08-11 18:05:43 +08:00
|
|
|
preferLocalBuild = true;
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
dontPatchShebangs = true;
|
|
|
|
installPhase = ''
|
2021-02-08 21:14:08 +08:00
|
|
|
cat > $out <<"EOF"
|
2020-12-07 23:33:40 +08:00
|
|
|
#!/bin/sh -e
|
2021-02-08 21:14:08 +08:00
|
|
|
for n in $(seq 1 ${toString loops}); do
|
|
|
|
export GARLIC_RUN="$n"
|
|
|
|
echo "running $n of ${toString loops}" > status
|
|
|
|
mkdir "$n"
|
|
|
|
cd "$n"
|
|
|
|
mkdir .garlic
|
|
|
|
date +%s > .garlic/total_time_start
|
2020-10-09 21:55:37 +08:00
|
|
|
${stageProgram nextStage}
|
2021-02-08 21:14:08 +08:00
|
|
|
date +%s > .garlic/total_time_end
|
2020-10-22 00:18:43 +08:00
|
|
|
cd ..
|
2020-08-11 18:05:43 +08:00
|
|
|
done
|
2020-10-26 16:24:18 +08:00
|
|
|
echo "completed" > status
|
2020-08-11 18:05:43 +08:00
|
|
|
EOF
|
2020-09-02 23:07:09 +08:00
|
|
|
chmod +x $out
|
2020-08-11 18:05:43 +08:00
|
|
|
'';
|
|
|
|
}
|