anchor.diff:  
       postUnpack = ''
           patchShebangs .
  +    ''
  +
  +    + stdenv.lib.optionalString (!bootstrapVersion && stdenv.hostPlatform.isDarwin) ''
  +        # http://forum.dlang.org/thread/xtbbqthxutdoyhnxjhxl@forum.dlang.org
  +        rm -r ldc-${version}-src/tests/dynamiccompile
  +
  +        # https://github.com/NixOS/nixpkgs/issues/34817
  +        rm -r ldc-${version}-src/tests/plugins/addFuncEntryCall
  +
  +        # https://github.com/NixOS/nixpkgs/pull/36378#issuecomment-385034818
  +        rm -r ldc-${version}-src/tests/debuginfo/classtypes_gdb.d
  +        rm -r ldc-${version}-src/tests/debuginfo/nested_gdb.d
  +
  +        rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/test16096.sh
  +        rm ldc-${version}-src/tests/d2/dmd-testsuite/compilable/ldc_output_filenames.sh
  +        rm ldc-${version}-src/tests/d2/dmd-testsuite/compilable/crlf.sh
  +        rm ldc-${version}-src/tests/d2/dmd-testsuite/compilable/issue15574.sh
  +        rm ldc-${version}-src/tests/d2/dmd-testsuite/compilable/test6461.sh
  +    ''
  +
  +    + stdenv.lib.optionalString (!bootstrapVersion) ''
  +        echo ${tzdata}/share/zoneinfo/ > ldc-${version}-src/TZDatabaseDirFile
   
           # Remove cppa test for now because it doesn't work.
           rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/cppa.d
           rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/extra-files/cppb.cpp
  -    ''
  -
  -    + stdenv.lib.optionalString (bootstrapVersion) ''
  -        # ... runnable/variadic.d            ()
  -        #Test failed.  The logged output:
  -        #/tmp/nix-build-ldcBuild-0.17.5.drv-0/ldc-0.17.5-src/build/bin/ldmd2 -conf= -m64 -Irunnable   -od/tmp/nix-build-ldcBuild-0.17.5.drv-0/ldc-0.17.5-src/build/dmd-testsuite/runnable -of/tmp/nix-build-ldcBuild-0.17.5.drv-0/ldc-0.17.5-src/build/dmd-testsuite/runnable/variadic_0 runnable/variadic.d
  -        #Error: integer constant expression expected instead of <cant>
  -        #Error: integer constant expression expected instead of <cant>
  -        #Error: integer constant expression expected instead of <cant>
  -        #Error: integer constant expression expected instead of <cant>
  -        #Error: integer constant expression expected instead of <cant>
  -        #runnable/variadic.d(84): Error: template instance variadic.Foo3!(int, int, int) error instantiating
  -        #
  -        #
  -        #==============================
  -        #Test failed: expected rc == 0, exited with rc == 1
  -        rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/variadic.d
  -    ''
  -
  -    + stdenv.lib.optionalString (!bootstrapVersion) ''
  -	    # http://forum.dlang.org/thread/xtbbqthxutdoyhnxjhxl@forum.dlang.org
  -	    rm -r ldc-${version}-src/tests/dynamiccompile
  -
  -            # https://github.com/NixOS/nixpkgs/issues/34817
  -	    rm -r ldc-${version}-src/tests/plugins/addFuncEntryCall
  -    '';
  -
  -    ROOT_HOME_DIR = "$(echo ~root)";
  +    '';
   
       datetimePath = if bootstrapVersion then
         "phobos/std/datetime.d"
  
positive.code: 
      buildInputs = [ curl tzdata ];
  
      preConfigure = ''
        cmakeFlagsArray=("-DINCLUDE_INSTALL_DIR=$out/include/dlang/ldc"
                         "-DCMAKE_BUILD_TYPE=Release"
                         "-DCMAKE_SKIP_RPATH=ON"
                         "-DBUILD_SHARED_LIBS=OFF"
                         "-DLDC_WITH_LLD=OFF"
                         # Xcode 9.0.1 fixes that bug according to ldc release notes
                         "-DRT_ARCHIVE_WITH_LDC=OFF"
                        )
      '';
  
  
      postConfigure = ''
        export DMD=$PWD/bin/ldmd2
  
negative.code: 
      makeFlags = [ "DMD=$DMD" ];
  
      doCheck = !bootstrapVersion;
  
      checkPhase = ''
        # Build and run LDC D unittests.
  