Building Emacs with Nix produce a different/lacking version when build manually on macOS

A bit of context, I was forced to ditch Homebrew when they started to deprecate macOS 11.7.10, so I decided to give Nix a try. So far, I’ve been using it in the most trivial way, that is to install stuff with nix-env -iA nixpkgs.stuff, that’s well enough for me.

I found that Emacs was among the Nix packages, so I installed it the same way and used it for a bit, it worked but it seemed lacking when compared to the Emacs+ Homebrew version that I was using. I blamed the additional Emacs+ patches at first, but after some trials and error I found out that, building Emacs with Nix (I also tried to write a simple derivation/override) produces a fundamentally different Emacs when compared to a version build without it.

In particular let’s focus on reproducible stuff, in Emacs from Nix the following doesn’t work, meaning that the internal-border color is ignored:

(custom-set-variables
 '(default-frame-alist '((internal-border-width . 100))))

(custom-set-faces
 '(default ((t (:background "black" :foreground "white"))))
 '(internal-border ((t (:background "red")))))

While it works if I manually build Emacs.

I suspect that what changes is that if I build Emacs with Nix I get to use the pkgs.darwin.apple_sdk.frameworks.AppKit dependency, whereas when building it manually, I just use the system version.

So the question is twofold:

  • why does this happens?

  • if I’m right about AppKit, how can I just use the system version of that framework?

I don’t really care about reproducibility in this case.