anchor.diff:          make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${pathToDmd} BUILD=release
           cd ..
       '';
  +
  +    extension = if stdenv.hostPlatform.isDarwin then "a" else "{a,so}";
       
  -    extension = if stdenv.hostPlatform.isDarwin then "a" else "{a,so}";
  -
       dontStrip = true;
   
       installPhase = ''
  
positive.code:     else
        stdenv.hostPlatform.parsed.kernel.name;
      top = "$(echo $NIX_BUILD_TOP)";
      pathToDmd = if bootstrapVersion then
        "${top}/dmd/src/dmd"
      else
        "${top}/dmd/generated/${osname}/release/${bits}/dmd";
  
      # Buid and install are based on http://wiki.dlang.org/Building_DMD
      buildPhase = ''
          cd dmd
          make -j$NIX_BUILD_CORES -f posix.mak INSTALL_DIR=$out
          cd ../druntime
          make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
          cd ../phobos
          make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd} TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
          cd ..
      '';
  
      doCheck = !bootstrapVersion;
  
      checkPhase = ''
          cd dmd
  
negative.code: 
    # Need to test Phobos in a fixed-output derivation, otherwise the
    # network stuff in Phobos would fail if sandbox mode is enabled.
    #
    # 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
  
  