anchor.diff:  with pkgs;
   
   runCommand "nixpkgs-metrics"
  -  { buildInputs = [ nix time ];
  +  { nativeBuildInputs = with pkgs.lib; map getBin [ nix time jq ];
       requiredSystemFeatures = [ "benchmark" ];
     }
     ''
  
positive.code:     num=$(nix-env -f ${nixpkgs} -qa | wc -l)
      echo "nix-env.qaCount $num" >> $out/nix-support/hydra-metrics
  
      export GC_INITIAL_HEAP_SIZE=128k
      run nix-env.qaAggressive nix-env -f ${nixpkgs} -qa
      run nix-env.qaDrvAggressive nix-env -f ${nixpkgs} -qa --drv-path --meta --xml
  
  
negative.code:       shift
  
        echo "running $@"
        NIX_SHOW_STATS=1 time -o stats-time "$@" 2>stats-nix
        sed '/^warning:/d' -i stats-nix
  
        cat stats-nix; echo; cat stats-time; echo
  
        x=$(jq '.cpuTime' < stats-nix)
        [[ -n $x ]] || exit 1
        echo "$name.time $x s" >> $out/nix-support/hydra-metrics
  
        x=$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' < stats-time)
        [[ -n $x ]] || exit 1
        echo "$name.maxresident $x KiB" >> $out/nix-support/hydra-metrics
  
        # nix-2.2 also outputs .symbols.bytes but that wasn't summed originally
        # https://github.com/NixOS/nix/pull/2392/files#diff-8e6ba8c21672fc1a5f6f606e1e101c74L1762
        x=$(jq '[.envs,.list,.values,.sets] | map(.bytes) | add' < stats-nix)
        [[ -n $x ]] || exit 1
        echo "$name.allocations $x B" >> $out/nix-support/hydra-metrics
  
        x=$(jq '.values.number' < stats-nix)
        [[ -n $x ]] || exit 1
        echo "$name.values $x" >> $out/nix-support/hydra-metrics
      }
  