2020-08-11 12:05:43 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
}:
|
|
|
|
|
2020-09-02 17:07:09 +02:00
|
|
|
{
|
|
|
|
program
|
2020-09-03 16:18:50 +02:00
|
|
|
, loops ? 30
|
2020-09-02 17:07:09 +02:00
|
|
|
}:
|
2020-08-11 12:05:43 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2020-09-02 17:07:09 +02:00
|
|
|
name = "control";
|
2020-08-11 12:05:43 +02:00
|
|
|
preferLocalBuild = true;
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
dontPatchShebangs = true;
|
|
|
|
installPhase = ''
|
2020-09-02 17:07:09 +02:00
|
|
|
cat > $out <<EOF
|
2020-08-11 12:05:43 +02:00
|
|
|
#!/bin/sh
|
2020-09-02 10:44:13 +02:00
|
|
|
#set -e
|
2020-09-03 16:18:50 +02:00
|
|
|
for n in {1..${toString loops}}; do
|
2020-09-02 17:07:09 +02:00
|
|
|
${program}
|
2020-08-11 12:05:43 +02:00
|
|
|
done
|
|
|
|
EOF
|
2020-09-02 17:07:09 +02:00
|
|
|
chmod +x $out
|
2020-08-11 12:05:43 +02:00
|
|
|
'';
|
|
|
|
}
|