Fix trebuchet description

This commit is contained in:
Rodrigo Arias 2020-10-09 20:28:00 +02:00
parent aa1ffa5208
commit 6ab448b10a
3 changed files with 10 additions and 16 deletions

View File

@ -1,5 +1,6 @@
{
stdenv
, garlicTools
}:
{
@ -7,20 +8,11 @@
}:
with stdenv.lib;
with garlicTools;
let
stageProgram = stage:
if stage ? programPath
then "${stage}${stage.programPath}" else "${stage}";
unitsString = builtins.concatStringsSep "\n"
(map (x: "${stageProgram x}") units);
desc = builtins.concatStringsSep "\n"
(map (x: ''
# ${x}
${x.desc}'') units);
in
stdenv.mkDerivation {
name = "experiment";
@ -28,14 +20,11 @@ stdenv.mkDerivation {
preferLocalBuild = true;
dontPatchShebangs = true;
inherit units;
inherit desc;
installPhase = ''
cat > $out << EOF
#!/bin/sh
${desc}
# This is an experiment formed by the following units:
${unitsString}
EOF

View File

@ -21,6 +21,7 @@ stdenv.mkDerivation {
dontPatchShebangs = true;
programPath = "/bin/stage1";
inherit nixPrefix clusterName nixtools busybox;
inherit nextStage;
program = stageProgram nextStage;
desc = "# $out\n" + (if builtins.hasAttr "desc" nextStage then nextStage.desc else "");
out = "$out";

View File

@ -13,14 +13,17 @@
, targetCluster ? "mn4"
}:
with garlicTools;
let
program = garlicTools.stageProgram nextStage;
program = stageProgram nextStage;
in
stdenv.mkDerivation {
name = "trebuchet";
phases = [ "installPhase" ];
preferLocalBuild = true;
dontPatchShebangs = true;
inherit nextStage;
installPhase = ''
cat > $out <<EOF
#!/bin/sh -e
@ -29,8 +32,9 @@ stdenv.mkDerivation {
# Take a look at ${program}
# to see what is being executed.
# $out
${nextStage.desc}
# This trebuchet launches the following experiment in an isolated
# environment:
# ${nextStage.nextStage}
nixtools=${nixPrefix}${nixtools}/bin
runexp=\$nixtools/${targetCluster}/runexp