@@ -192,6 +192,15 @@ stdenv.mkDerivation (rec {
192192 url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c6132c782d974a7701e7f6447bdcd2bf6db4299a.patch?merge_request_iid=7423";
193193 sha256 = "sha256-b4feGZIaKDj/UKjWTNY6/jH4s2iate0wAgMxG3rAbZI=";
194194 })
195+ ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
196+
197+ # Prevent the paths module from emitting symbols that we don't use
198+ # when building with separate outputs.
199+ #
200+ # These cause problems as they're not eliminated by GHC's dead code
201+ # elimination on aarch64-darwin. (see
202+ # https://github.com/NixOS/nixpkgs/issues/140774 for details).
203+ ./cabal-paths.patch
195204 ];
196205
197206 postPatch = "patchShebangs .";