anchor.diff:            prettytail "${padName n}" "$build/${f}" &
           '') cfg.tailFiles)}
   
  -        wait $virshpid || exit 1
  -
  -        mkdir $out
  -        cp -r build/* $out/
  -
  -        ${cfg.extraBuildSteps}
  +        # Wait for the test script to finish and then run any extra steps
  +        wait $virshpid && out=$out extra-build-steps || touch build/failed
  +
  +        # Put build products in place
  +        cp -rnT build $out
  +        mkdir -p $out/nix-support
  +
  +        (
  +          echo "file log $out/stdout"
  +          echo "file log $out/stderr"
  +          for i in ${toString instNames}; do for l in console journal; do
  +            echo "file log $out/hosts/$i/$l.log"
  +          done; done
  +        ) >> $out/nix-support/hydra-build-products
  +
  +        if [ -a $out/failed ]; then
  +          rm $out/failed
  +          exit 1
  +        fi
         '';
       };
   
  
positive.code:       '';
  
        phases = [ "buildPhase" ];
  
        buildPhase = ''
          function prettytail() {
  
negative.code:         default = 600;
        };
  
        out = mkOption {
          type = types.path;
          description = ''
            The result of the test, as a nix derivation.
          '';
        };
  
        backend = mkOption {
  