Emacs-overlay gives architecture, compiler version, and macOS mismatch warnings

I am new to Nix and wanted to use it in an imperative way initially, using nix profile. One test case I had was building a recent version of Emacs with useful features like tree-sitter (works), vterm (works), and native compilation (works, maybe?). I did this like so:

$ nix registry add flake:emacs-overlay github:nix-community/emacs-overlay
$ nix profile install emacs-overlay#emacsGit

This is on an M2 Mac, using the Determinate Systems installer. Building Emacs succeeds and attempts to native compile, but gives a lot of warnings like this in the *Warnings* buffer:

⛔ Warning (comp): aarch64-apple-darwin-gcc-11.3.0: warning: could not understand version ‘13.00.00’
⛔ Warning (comp): ld: warning: object file (/var/folders/l8/lb3w7yxs01g_sm723x50r_dh0000gn/T//ccvNXG4s.o) was built for newer macOS version (13.0) than being linked (11.0)
⛔ Warning (comp): ld: warning: could not create compact unwind for _F6e69782d2d70726f66696c652d7061746873_nix__profile_paths_0: register 22 saved somewhere other than in frame
⛔ Warning (comp): ld: warning: ignoring file /nix/store/cf3kc56v1f51x68v6yvmjn1rzwfd864i-libSystem-11.0.0/lib/dylib1.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
⛔ Warning (comp): aarch64-apple-darwin-gcc-11.3.0: warning: could not understand version ‘13.00.00’

(/var/folders/l8/lb3w7yxs01g_sm723x50r_dh0000gn/T/ccvNXG4s.o does not appear to exist. I’m not sure if it’s supposed to be temporary.)

How can I debug this? My first questions are:

  1. Why is /nix/store/cf3kc56v1f51x68v6yvmjn1rzwfd864i-libSystem-11.0.0/lib/dylib1.o an x86-64 version? I confirmed it is with file - can I tell Nix to build that for arm64 instead?
  2. Why is this building with gcc 11? My system GCC (well, clang) is the default one from macOS’s developer tools. Again, can I tell Nix to use a matching version here?
  3. What is going on with the object files being built for an older macOS? Is this the same problem as 2?

Emacs itself appears usable but some of these warnings are a little concerning to me, and I’d love to understand more about how to dig into them.

OK, installing on an Intel Mac gives me the same warnings about GCC, but I don’t have the architecture issues.

I can’t install libgccjit on its own due to Cannot install `libgccjit` package with other `lib*` packages · Issue #209123 · NixOS/nixpkgs · GitHub, but I can see that libgcc is version 11:

$ nix search nixpkgs libgcc
* legacyPackages.aarch64-darwin.libgcc (11.3.0)

* legacyPackages.aarch64-darwin.libgccjit (12.2.0)
  GNU Compiler Collection, version 12.2.0

Which I think means I need gcc: fix libgccjit cross by amjoseph-nixpkgs · Pull Request #217874 · NixOS/nixpkgs · GitHub (to fix the architecture issue). That in turn needs stdenv: Nix-driven bootstrap of gcc by amjoseph-nixpkgs · Pull Request #209870 · NixOS/nixpkgs · GitHub - or maybe I just need the latter?