anchor.diff: -{ stdenv, fetchurl, jdk, zip, unzip, bash, makeWrapper, which }:
  +{ stdenv, lib, fetchurl, jdk, zip, unzip, bash, writeScriptBin, coreutils, makeWrapper, which, python }:
   
   stdenv.mkDerivation rec {
   
  -  version = "0.4.5";
  +  version = "0.5.4";
   
     meta = with stdenv.lib; {
  -    homepage = https://github.com/bazelbuild/bazel/;
  +    homepage = "https://github.com/bazelbuild/bazel/";
       description = "Build tool that builds code quickly and reliably";
       license = licenses.asl20;
       maintainers = [ maintainers.philandstuff ];
  
positive.code:   installPhase = ''
      mkdir -p $out/bin
      mv output/bazel $out/bin
      wrapProgram "$out/bin/bazel" --prefix PATH : "${stdenv.cc}/bin:${jdk}/bin"
      mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions
      mv output/bazel-complete.bash $out/share/bash-completion/completions/
      cp scripts/zsh_completion/_bazel $out/share/zsh/site-functions/
  
negative.code: 
    src = fetchurl {
      url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
      sha256 = "1jdb8zbgafhz2qi0ajk34845kpmfhxchdimvwkq6lkb1159v0mr1";
    };
  
    sourceRoot = ".";
  
    # Bazel expects several utils to be available in Bash even without PATH. Hence this hack.
  
    customBash = writeScriptBin "bash" ''
      #!${stdenv.shell}
      PATH="$PATH:${lib.makeBinPath [ coreutils ]}" exec ${bash}/bin/bash "$@"
    '';
  
    postPatch = ''
      find src/main/java/com/google/devtools -type f -print0 | while IFS="" read -r -d "" path; do
        substituteInPlace "$path" \
          --replace /bin/bash ${customBash}/bin/bash \
          --replace /usr/bin/env ${coreutils}/bin/env
      done
      patchShebangs .
    '';
  
    buildInputs = [
      jdk
    ];
  
    nativeBuildInputs = [
      zip
      python
      unzip
      makeWrapper
      which
      customBash
    ];
  
    # If TMPDIR is in the unpack dir we run afoul of blaze's infinite symlink
  