This post focused solely on the Nix package manager and Nix packages - for anyone that uses MacOS but is interesting in trying NixOS (or using it within a VM in MacOS), I definitely recommend Mitchell Hashimoto's NixOS repo: https://github.com/mitchellh/nixos-config Honestly, doing that may be easier and a better option than using Nix packages in MacOS.
For all of my personal machines, I use NixOS (both hardware and in cloud machines). But for work, we have a soft-MacOS mandate. On that m1 macbook pro, I run nix-darwin for the mac specific settings I want, and packages that I run in macos, but everything else in a NixOS VM similar to mitchellh/nixos-config. I use UTM (a nice wrapper around qemu), but the rest is just standard nix config, of which, nearly all of it I…
Using Nix on macOS
51–60 of 116 posts
Re: Using Nix on macOS
#52This post focused solely on the Nix package manager and Nix packages - for anyone that uses MacOS but is interesting in trying NixOS (or using it within a VM in MacOS), I definitely recommend Mitchell Hashimoto's NixOS repo: https://github.com/mitchellh/nixos-config Honestly, doing that may be easier and a better option than using Nix packages in MacOS.
> Honestly, doing that may be easier and a better option than using Nix packages in MacOS. Respectfully, I disagree. I’ve been using Nix on a couple of my Macs, including on an M1, and I’ve cutdown my dependence on homebrew almost to the point of its absence; I rely more on Nix packages, than on Homebrew packages. Having said that, I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough…
I'd like to think there are roughly two camps of people:
Those who hear about Nix's declarative nature, with its reproducible/'pure' nature, and generational installation, all of which allow for some pretty neat UX. To this group, Nix sounds technically interesting.
The other group, those who want a tool that just works, that's simple to use, and already get their job done with other package managers. -- I think for this group, Nix is going to be a bad tool to recommend, even if they keep hearing about how neat Nix is.
Rather. Nix is wonderful 95% of the time. But the 5% of the time you run into some problem, it's much more difficult to get unstuck compared to other tools. (Other knowledge is necessary but not sufficient, the community is small so maybe harder to find a StackOverflow post, the documentation is fragmented, etc.).
Re: Using Nix on macOS
#53Re: Using Nix on macOS
#54Re: Using Nix on macOS
#55That seems like a hell of a lot more work than just using Home-Manager and flakes. Flakes add a lot of boilerplate, but this seems excessive in comparison. And Home-Manager is quite easy.
This blog post follows IanTheHenry's method for declarative environments via nix-env, which was produced when Ian was following a methodology for learning Nix that deliberately eschewed engagement with the Nix community in favor of relying only on the official documentation. So it doesn't use flakes or any unofficial community tools that could make setup 'easier' in the sense of being a bit more ready-made. Anyway I…
(Aside: I can't imagine figuring out how to use nix just from the official documentation. Those documents are a total mismatch from what the audience needs, focusing way too much on how to write your own custom modules, and not nearly enough on actually consuming them or decent patterns for it)
[0]: people are allowed to do what they want. But the path chosen by this author is not the easy path
Re: Using Nix on macOS
#56This post focused solely on the Nix package manager and Nix packages - for anyone that uses MacOS but is interesting in trying NixOS (or using it within a VM in MacOS), I definitely recommend Mitchell Hashimoto's NixOS repo: https://github.com/mitchellh/nixos-config Honestly, doing that may be easier and a better option than using Nix packages in MacOS.
> Honestly, doing that may be easier and a better option than using Nix packages in MacOS. Respectfully, I disagree. I’ve been using Nix on a couple of my Macs, including on an M1, and I’ve cutdown my dependence on homebrew almost to the point of its absence; I rely more on Nix packages, than on Homebrew packages. Having said that, I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough…
I _really_ like being able to drop into a shell with a few additional packages installed. But nix does have a learning curve and some rough edges. I found it tricky to use things like libraries outside of nix's build process. And there is a bit of an impedance mismatch when trying to use languages that have their own package management.
So I've got nix for a bunch of software, a couple of libraries in homebrew, and native package management for various languages (cargo, ghcup, lake, idris).
I also reluctantly installed agda via homebrew because I can't get it to build. (Haskell mostly works on M1).
Re: Using Nix on macOS
#57Christ that's a lot of work, just to start working on work. I really want to like Nix, but the UX is frankly offputting. I really hope it improves to the point that it can be mindlessly installed.
I wouldn’t take this one blog post as gospel about how to use Nix. I’m not denying that it’s complicated, but doing declarative package management is not the only way to dip your toes into Nix. You can use it pretty much as a conventional package manager with none of the upsides of declarative package management (but none of the complexity either). On the surface level for people migrating from existing package manag…
Re: Using Nix on macOS
#58Something not mentioned here is that each and every single macOS update will break your Nix install too. This is, by far, the most frustrating part of using Nix on macOS.
Re: Using Nix on macOS
#59Perhaps what is missing is the book "Nix - The good parts". Not saying Nix is not good overall, but getting a condensed description what is worth knowing, leaving out what can be ignored or is obsolete, would be quite valuable.
Here you go: - don't use nix-env ever - enable and use the new nix command (nix3) - enable and use flakes - use home-manager - if on macOS, use nix-darwin - with flakes, freely use nixpkgs unstable (stable is still useful, but flakes provide their own stability through pinned versions).
Re: Using Nix on macOS
#60Something not mentioned here is that each and every single macOS update will break your Nix install too. This is, by far, the most frustrating part of using Nix on macOS.
The only things that broke for me after the update were the xcode command-line tools, which break for everyone[1].
[1](https://stackoverflow.com/questions/32893412/command-line-to...)