tools: recursive getExperiment

It allows getExperimentStage to be called from any stage above the
experiment.
This commit is contained in:
Rodrigo Arias 2020-11-20 15:34:14 +01:00
parent d192a59fdc
commit 8bc5656461
2 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,8 @@ stdenv.mkDerivation {
dontPatchShebangs = true;
inherit units;
isExperiment = true;
installPhase = ''
cat > $out << EOF
#!/bin/sh

View File

@ -40,7 +40,9 @@ let
else "${stage}";
/* Given a trebuchet, returns the experiment */
getExperimentStage = drv: drv.nextStage.nextStage.nextStage;
getExperimentStage = drv:
if (drv ? isExperiment) && drv.isExperiment then drv
else getExperimentStage drv.nextStage;
# Computes the exponentiation operation
pow = x: n: fold (a: b: a*b) 1 (map (a: x) (range 1 n));