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

View File

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

View File

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