3 ms·
Nix support on macOS is pretty good, but it's not the main OS of most Nixpkgs contributors and that does show in some ways, and there are some differences in us
by pxc 4y ago
Nix support on macOS is pretty good, but it's not the main OS of most Nixpkgs contributors and that does show in some ways, and there are some differences in using it as a 'guest' package manager rather than having it run the whole show.
First, the bad:
Apple does minorly break things on every OS upgrade by nuking all of your systemwide shell RC files, besides the more substantial. (There's been some investigation into more robust ways to get that integration working, but so far none of the leads are very promising.)
Nix on macOS has to do some weird stuff to achieve integration due to macOS' security features like SIP and non-writable /. Nowadays the installer just takes care of this.
macOS GUI apps don't get built by Hydra, so they're not in the binary cache. This is because they require proprietary software (Xcode) to build, and Hydra doesn't build or cache non-free derivations as a legal precaution. For grabbing things like iTerm or whatever, you might prefer using Homebrew in a limited way ('casks' only) with a non-standard prefix. This is what I have done and recommend doing. (That said, macOS GUI apps do exist in Nixpkgs and they build just fine, so if you want you can still use Nix for your iTerm and your custom Emacs build and whatever.)
Now the good parts:
Package availability on macOS is still great.
Nix feels really fast compared to Homebrew!
There's a new, alternative Nix installer available from a credible company in the Nix community that seems to cope a bit better with macOS' integration quirks, making uninstalling and reinstalling a bit easier: https://github.com/DeterminateSystems/nix-installer https://github.com/DeterminateSystems/nix-installer
If you like NixOS' declarative style and service/configuration management capabilities, there's an awesome module system that lets you get a very similar experience on macOS: https://daiderd.com/nix-darwin/ https://daiderd.com/nix-darwin/
The ugly(?):
The default build environment for packages on macOS uses a completely different toolchain than Nix uses on Linux. LLVM instead of GCC, libsystem instead of glibc. This is appropriate and generally invisible, but you may notice it and think about it when writing your own packages or something like that.
Nix builds and the environment in general are a bit less 'pure' on macOS. Some of that is part of what I just mentioned above. Another aspect is that Nix builds are not sandboxed on macOS.
I hope that helps! Overall, if you like NixOS, I think you will find lots to like about Nix on Mac. :)
- fnordpiglet 4y agoAmazing thank you super helpful!