anchor.diff:  
     postPatch = ''
       substituteInPlace theano/configdefaults.py \
  -      --replace 'StrParam(param, is_valid=warn_cxx)' 'StrParam('\'''${gcc_}/bin/g++'\''', is_valid=warn_cxx)' \
  +      --replace 'StrParam(param, is_valid=warn_cxx)' 'StrParam('\'''${cxx_compiler}'\''', is_valid=warn_cxx)' \
         --replace 'rc == 0 and config.cxx != ""' 'config.cxx != ""'
     '' + stdenv.lib.optionalString cudaSupport ''
       substituteInPlace theano/configdefaults.py \
  
positive.code: { stdenv
  , lib
  , fetchPypi
  , gcc
  , writeScriptBin
  , buildPythonPackage
  , isPyPy
  , pythonOlder
  
negative.code:                    && cudnn != null;
  
  let
    wrapped = command: buildTop: buildInputs:
      runCommandCC "${command}-wrapped" { inherit buildInputs; } ''
        type -P '${command}' || { echo '${command}: not found'; exit 1; }
        cat > "$out" <<EOF
        #!$(type -P bash)
        $(declare -xp | sed -e '/^[^=]\+="\('"''${NIX_STORE//\//\\/}"'\|[^\/]\)/!d')
        declare -x NIX_BUILD_TOP="${buildTop}"
        $(type -P '${command}') "\$@"
        EOF
        chmod +x "$out"
      '';
  
    # Theano spews warnings and disabled flags if the compiler isn't named g++
    cxx_compiler = wrapped "g++" "\\$HOME/.theano"
      (    stdenv.lib.optional cudaSupport libgpuarray_
        ++ stdenv.lib.optional cudnnSupport cudnn );
  
    libgpuarray_ = libgpuarray.override { inherit cudaSupport cudatoolkit; };
  
  