anchor.diff:    src = fetchurl binDistUsed.src;
   
     nativeBuildInputs = [ perl ];
  -  propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];
  +  propagatedBuildInputs =
  +    lib.optionals useLLVM [ llvmPackages.llvm ]
  +    # Because musl bindists currently provide no way to tell where
  +    # libgmp is (see not [musl bindists have no .buildinfo]), we need
  +    # to propagate `gmp`, otherwise programs built by this ghc will
  +    # fail linking with `cannot find -lgmp` errors.
  +    # Also, as of writing, the release pages of musl bindists claim
  +    # that they use `integer-simple` and do not require `gmp`; however
  +    # that is incorrect, so `gmp` is required until a release has been
  +    # made that includes https://gitlab.haskell.org/ghc/ghc/-/issues/20059.
  +    # (Note that for packaging the `-binary` compiler, nixpkgs does not care
  +    # about whether or not `gmp` is used; this comment is just here to explain
  +    # why the `gmp` dependency exists despite what the release page says.)
  +    ++ lib.optionals stdenv.hostPlatform.isMusl [ gmp ]; # musl bindist needs this
   
     # Set LD_LIBRARY_PATH or equivalent so that the programs running as part
     # of the bindist installer can find the libraries they expect.
  
positive.code:       patchShebangs ghc-${version}/configure
      '' +
      # We have to patch the GMP paths for the integer-gmp package.
      ''
        find . -name integer-gmp.buildinfo \
            -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
  
negative.code:   libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
      + "LD_LIBRARY_PATH";
  
  in
  
  stdenv.mkDerivation rec {
  