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 = ''
|
2020-09-02 23:07:09 +08:00
|
|
|
cat > $out <<EOF
|
2020-08-11 18:05:43 +08:00
|
|
|
#!/bin/sh
|
2020-10-07 16:55:40 +08:00
|
|
|
for n in \$(seq 1 ${toString loops}); do
|
2020-10-22 00:18:43 +08:00
|
|
|
mkdir "\$n"
|
|
|
|
cd "\$n"
|
2020-10-09 21:55:37 +08:00
|
|
|
${stageProgram nextStage}
|
2020-10-22 00:18:43 +08:00
|
|
|
cd ..
|
2020-08-11 18:05:43 +08:00
|
|
|
done
|
|
|
|
EOF
|
2020-09-02 23:07:09 +08:00
|
|
|
chmod +x $out
|
2020-08-11 18:05:43 +08:00
|
|
|
'';
|
|
|
|
}
|