anchor.diff:  
     # Need to test Phobos in a fixed-output derivation, otherwise the
     # network stuff in Phobos would fail if sandbox mode is enabled.
  -  phobosUnittests = stdenv.mkDerivation rec {
  -    name = "phobosUnittests-${version}";
  -    version = dmdBuild.version;
  -
  -    enableParallelBuilding = dmdBuild.enableParallelBuilding;
  -    preferLocalBuild = true;
  -    inputString = dmdBuild.outPath;
  -    outputHashAlgo = "sha256";
  -    outputHash = builtins.hashString "sha256" inputString;
  -
  -    srcs = dmdBuild.srcs;
  -
  -    sourceRoot = ".";
  -
  -    postPatch = dmdBuild.phobosPatches;
  -
  -    nativeBuildInputs = dmdBuild.nativeBuildInputs;
  -    buildInputs = dmdBuild.buildInputs;
  -
  -    buildPhase = ''
  -        cd phobos
  -        make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${dmdBuild}/bin/dmd BUILD=release TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
  -    '';
  -
  -    installPhase = ''
  -        echo -n $inputString > $out
  -    '';
  -  };
  +  #
  +  # Disable tests on Darwin for now because of
  +  # https://github.com/NixOS/nixpkgs/issues/41099
  +  phobosUnittests = if !stdenv.hostPlatform.isDarwin then
  +    stdenv.mkDerivation rec {
  +      name = "phobosUnittests-${version}";
  +      version = dmdBuild.version;
  +
  +      enableParallelBuilding = dmdBuild.enableParallelBuilding;
  +      preferLocalBuild = true;
  +      inputString = dmdBuild.outPath;
  +      outputHashAlgo = "sha256";
  +      outputHash = builtins.hashString "sha256" inputString;
  +
  +      srcs = dmdBuild.srcs;
  +
  +      sourceRoot = ".";
  +
  +      postPatch = dmdBuild.phobosPatches;
  +
  +      nativeBuildInputs = dmdBuild.nativeBuildInputs;
  +      buildInputs = dmdBuild.buildInputs;
  +
  +      buildPhase = ''
  +          cd phobos
  +          make -j$NIX_BUILD_CORES -f posix.mak unittest BUILD=release ENABLE_RELEASE=1 PIC=1 DMD=${dmdBuild}/bin/dmd TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
  +      '';
  +
  +      installPhase = ''
  +          echo -n $inputString > $out
  +      '';
  +    }
  +  else
  +    "";
   
   in
   
  
positive.code: { stdenv, fetchFromGitHub, overrideCC, gcc5
  , makeWrapper, unzip, which
  , curl, tzdata, gdb, darwin
  , callPackage, targetPackages
  , bootstrapVersion ? false
  , version ? "2.079.1"
  , dmdSha256 ? "0mlk095aw94d940qkymfp85daggiz3f0xv598nlc7acgp6408kyj"
  , druntimeSha256 ? "18r8gwvb54ar80j5155wx0qbqq4w56hqmbf6wap20xwijg2rw90g"
  , phobosSha256 ? "1x5v1ln51nr8x2vyki864160bakdyq0acmvbfv7jcipaj2w3m9bb"
  }:
  
  let
  
    bootstrapDmd = if !bootstrapVersion then
      # Versions 2.070.2 and up require a working dmd compiler to build so we just
      # use the last dmd without any D code to bootstrap the actual build.
      callPackage ./default.nix {
        stdenv = if stdenv.hostPlatform.isDarwin then
                   stdenv
                 else
                   # Doesn't build with gcc6 on linux
                   overrideCC stdenv gcc5;
        bootstrapVersion = true;
        version = "2.067.1";
        dmdSha256 = "0fm29lg8axfmzdaj0y6vg70lhwb5d9rv4aavnvdd15xjschinlcz";
        druntimeSha256 = "1n2qfw9kmnql0fk2nxikispqs7vh85nhvyyr00fk227n9lgnqf02";
        phobosSha256 = "0fywgds9xvjcgnqxmpwr67p3wi2m535619pvj159cgwv5y0nr3p1";
      }
    else
      "";
  
    dmdBuild = stdenv.mkDerivation rec {
      name = "dmdBuild-${version}";
  
negative.code:         substituteInPlace phobos/posix.mak \
              --replace "-soname=libcurl.so.4" "-soname=${curl.out}/lib/libcurl.so.4"
  
      '';
  
      postPatch = ''
          substituteInPlace druntime/test/common.mak \
              --replace "DFLAGS:=" "DFLAGS:=${usePIC} "
  
          substituteInPlace dmd/src/posix.mak \
              --replace "DFLAGS :=" "DFLAGS += -link-defaultlib-shared=false"
      ''
  
      + phobosPatches
  
      + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
          substituteInPlace dmd/posix.mak \
              --replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_
      '';
  
      nativeBuildInputs = [ ldc makeWrapper unzip which gdb ]
  
      ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
        Foundation
  