Generate trebuchet from nix

This commit is contained in:
Rodrigo Arias 2020-10-07 18:41:21 +02:00
parent e8d884a627
commit 66a5e06ada
2 changed files with 14 additions and 19 deletions

View File

@ -12,14 +12,23 @@
stdenv.mkDerivation {
name = "trebuchet";
phases = [ "installPhase" ];
preferLocalBuild = true;
phases = [ "unpackPhase" "installPhase" ];
dontPatchShebangs = true;
src = ./.;
inherit sshHost nixPrefix nixtools targetCluster program;
installPhase = ''
substituteAllInPlace trebuchet
cp trebuchet $out
cat > $out <<EOF
#!/bin/sh -e
# Using the token @upload-to-mn@ we instruct the post-build hook to upload
# this script and it's closure to the MN4 cluster, so it can run there.
# Take a look at ${program}
# to see what is being executed.
nixtools=${nixPrefix}${nixtools}/bin
runexp=\$nixtools/${targetCluster}/runexp
>&2 echo "Launching \"\$runexp ${program}\" in MN4"
ssh ${sshHost} \$runexp ${program}
EOF
chmod +x $out
'';
}

View File

@ -1,14 +0,0 @@
#!/bin/sh -ex
# @upload-to-mn@
# This program runs the current experiment in the ./result symlink in
# MareNostrum. Requires that you define a "mn" host in the ssh config file
# (usually in ~/.ssh/config).
nixPrefix=@nixPrefix@
nixtools=$nixPrefix@nixtools@/bin
runexp=$nixtools/@targetCluster@/runexp
>&2 echo "Launching \"$runexp @program@\" in MN"
ssh mn $runexp @program@