bscpkgs/garlic/pp/result.nix

44 lines
978 B
Nix
Raw Normal View History

2020-10-15 18:48:50 +02:00
{
stdenv
, garlicTools
, fetchExperiment
}:
{
2020-10-16 15:53:28 +02:00
trebuchetStage
, experimentStage
2020-10-15 18:48:50 +02:00
, garlicTemp
}:
with garlicTools;
let
experimentName = baseNameOf (toString experimentStage);
fetcher = fetchExperiment {
sshHost = "mn1";
prefix = "/gpfs/projects/\\\$(id -gn)/\\\$(id -un)/garlic-out";
garlicTemp = "/tmp/garlic-temp";
2020-10-16 15:53:28 +02:00
inherit experimentStage trebuchetStage;
2020-10-15 18:48:50 +02:00
};
in
stdenv.mkDerivation {
name = "result";
preferLocalBuild = true;
__noChroot = true;
phases = [ "installPhase" ];
installPhase = ''
expPath=${garlicTemp}/${experimentName}
if [ ! -e $expPath ]; then
echo "The experiment ${experimentName} is missing in ${garlicTemp}."
echo "Please fetch it and try again."
2020-10-16 15:53:28 +02:00
echo "You can execute ${trebuchetStage} to run the experiment."
2020-10-15 18:48:50 +02:00
echo "And then ${fetcher} to get the results."
exit 1
fi
mkdir -p $out
cp -a ${garlicTemp}/${experimentName} $out
'';
}