anchor.diff:  
     useLLVM = !stdenv.targetPlatform.isx86;
   
  -  libPath = lib.makeLibraryPath ([
  -    # The i686-linux bindist provided by GHC HQ is currently built on Debian 9,
  -    # which link it against `libtinfo.so.5` (ncurses 5).
  -    # Other bindists are linked `libtinfo.so.6` (ncurses 6).
  -    (if stdenv.hostPlatform.system == "i686-linux" then ncurses5 else ncurses6)
  -    gmp
  -  ] ++ lib.optional (stdenv.hostPlatform.isDarwin) libiconv
  -    ++ lib.optional (stdenv.hostPlatform.isAarch64) numactl);
  +  libPath =
  +    lib.makeLibraryPath (
  +      [
  +        gmp
  +      ]
  +      # Add arch-specific libraries.
  +      ++ map ({ nixPackage, ... }: nixPackage) binDistUsed.archSpecificLibraries
  +    );
   
     libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
       + "LD_LIBRARY_PATH";
  
positive.code:   ${libEnvVar} = libPath;
  
    postUnpack =
      # GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib
      # during linking
      lib.optionalString stdenv.isDarwin ''
        export NIX_LDFLAGS+=" -no_dtrace_dof"
        # not enough room in the object files for the full path to libiconv :(
        for exe in $(find . -type f -executable); do
  
negative.code:   version = "8.10.2";
  
    # Information about available bindists that we use in the build.
    #
    # # Bindist library checking
    #
    # The field `archSpecificLibraries` also provides a way for us get notified
    # early when the upstream bindist changes its dependencies (e.g. because a
    # newer Debian version is used that uses a new `ncurses` version).
    #
    # Usage:
    #
    # * You can find the `fileToCheckFor` of libraries by running `readelf -d`
    #   on the compiler binary (`exePathForLibraryCheck`).
    # * To skip library checking for an architecture,
    #   set `exePathForLibraryCheck = null`.
    # * To skip file checking for a specific arch specfic library,
    #   set `fileToCheckFor = null`.
    ghcBinDists = {
      i686-linux = {
        src = {
          url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
          sha256 = "0bvwisl4w0z5z8z0da10m9sv0mhm9na2qm43qxr8zl23mn32mblx";
        };
        exePathForLibraryCheck = "ghc/stage2/build/tmp/ghc-stage2";
        archSpecificLibraries = [
          # The i686-linux bindist provided by GHC HQ is currently built on Debian 9,
          # which link it against `libtinfo.so.5` (ncurses 5).
          # Other bindists are linked `libtinfo.so.6` (ncurses 6).
          { nixPackage = ncurses5; fileToCheckFor = "libtinfo.so.5"; }
        ];
      };
      x86_64-linux = {
        src = {
          url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz";
          sha256 = "0chnzy9j23b2wa8clx5arwz8wnjfxyjmz9qkj548z14cqf13slcl";
        };
        exePathForLibraryCheck = "ghc/stage2/build/tmp/ghc-stage2";
        archSpecificLibraries = [
          { nixPackage = ncurses6; fileToCheckFor = "libtinfo.so.6"; }
        ];
      };
      armv7l-linux = {
        src = {
          url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz";
          sha256 = "1j41cq5d3rmlgz7hzw8f908fs79gc5mn3q5wz277lk8zdf19g75v";
        };
        exePathForLibraryCheck = "ghc/stage2/build/tmp/ghc-stage2";
        archSpecificLibraries = [
          { nixPackage = ncurses6; fileToCheckFor = "libtinfo.so.6"; }
        ];
      };
      aarch64-linux = {
        src = {
          url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz";
          sha256 = "14smwl3741ixnbgi0l51a7kh7xjkiannfqx15b72svky0y4l3wjw";
        };
        exePathForLibraryCheck = "ghc/stage2/build/tmp/ghc-stage2";
        archSpecificLibraries = [
          { nixPackage = ncurses6; fileToCheckFor = "libtinfo.so.6"; }
          { nixPackage = numactl; fileToCheckFor = null; }
        ];
      };
      x86_64-darwin = {
        src = {
          url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
          sha256 = "1hngyq14l4f950hzhh2d204ca2gfc98pc9xdasxihzqd1jq75dzd";
        };
        exePathForLibraryCheck = null; # we don't have a library check for darwin yet
        archSpecificLibraries = [
          { nixPackage = ncurses6; fileToCheckFor = null; }
          { nixPackage = libiconv; fileToCheckFor = null; }
        ];
      };
    };
  
  