I’ve been running it for a couple years, you can use it to try Nix without as much up front learning.
Almost 1000 stars!
https://github.com/dustinlyons/nixos-config
Edit: Just crossed 1k! Thanks HN
The most useful setup pattern I can share for both nix-darwin and home-manager is to configure them to store their rc files next to the system files, and not overwrite them ...
This keeps darwin/hm from fully replacing your mac /etc/zsh* ~/.zsh* files on each update and also keeps os system updates from destroying your nix files ...
You instead add sourcing statements in your system/home files to bring in your nix files.
These sourcing statements are nuked after every OS upgrade so first time you login, nothing looks right in your shell.
For this, I keep a copy of both the system file before the nix sources and a copy of the file after the nix sources ... If the post-updated version of the system file matches the backup then I can simply replace with the backup of the versions with sources included ... If they don't match, then I have to review the file, manually add the sources, and create new backups ...
I'll also say that the system files haven't changed in a long time (zsh) so I can just copy my etc/zsh*-nix-backup files into place then restart my shell and be back to good ...
macOS apps do weird shit to work around macOS quirks. But it's a really good installer. Can't recommend it enough.
This is a long blog post ending with a preview to "future installments of the guide" to use nix, while almost everything that you need to know with homebrew is `brew install/update/upgrade/uninstall`, and I have rarely run into any trouble with brew, and none at all in recent memory.
With nix, each project can define its own dependencies that have no impact on other projects. Combined with direnv, all you need is to `cd` into your project and you have the all of the dependencies at the right versions in your PATH.
Additionally, while definitely more complicated, nix (with nix-darwin and home-manager) can do way more than homebrew does. You can declaratively define pretty much the entire configuration for your machine.
I got a new Mac last week and with just a `git clone` and a few commands I had all my CLI tools installed, dotfiles setup, desktop apps installed, and even all of my macOS system settings configured.
(Maybe if you're already running NixOS and familiar with the latest it's a lot easier.)
I couldn't even uninstall it cleanly, since the Mac was new I gave up after some time and decided it was easier to reinstall macOS (which takes several hours but at least I can just leave it and then know that it's done).
So I'm back to (purely) brew (and scripts to `defaults write` etc.).
My frustration with brew is that it's getting increasingly opinionated, and those opinions are not familiar to me from any other OS/package manager... Like if you want postgres v15 you have to `brew install postgresql@15`, and then even if that's your only installed version it's 'keg-only', which means it's not on your PATH, and their suggestion is to dump some stuff at the end of your ~/.zshrc, which aside from the fact you're not using zsh and they could tell that, just seems dumb.
Then there's python & npm packages... They're deprecated and being removed as independent formulae, so don't do it like that. You're not allowed to install them with the python/node formula you installed, so don't do that. So what do you do, `python -m venv ~/system-python-venv` or something, activate it, and install in there. And now remember to activate that every time you want to use a command that happens to be a python package so you had to install it there. Or dump it in the end of your zshrc, I guess!
If you wanna give Nix-Darwin another go, I'm happy to help. Feel free to hit me up in the main Nix / NixOS channel or the Nix on macOS channel on Matrix. Getting everything working shouldn't take long with a little guidance.
(I can also help you get it cleanly uninstalled without reinstalling macOS, if you come away unsatisfied. I have manually uninstalled (i.e., not using the uninstaller) before.)
I run everything through an idempotent 'rebuild' script, so I don't really notice any day-to-day difference between nixos, standalone HM, or nix-darwin.
My biggest annoyance is that Homebrew is really slow; the Homebrew part of my Nix-Darwin rebuilds usuay takes 3-5x as long as everything else combined. Homebrew is really slow even when it has nothing to do.
The only caveat worth mentioning is that the module built into Nix-Darwin doesn't support installing Homebrew itself. Instead you tell it the prefix for an existing Homebrew installation.
(There is an out-of-tree module for installing Homebrew as well, but I haven't tried it.)
Having nix-darwin uninstall brews not declared in the flake makes me stay honest about keeping my configuration up to date as well, if I've just `brew install x` to try something it'll get removed next time I apply my config. Needs adding to the flake to keep it installed persistently, which in turn means my config tends to be up to date.
Note that you don't need nix-darwin to achieve that. I keep my homebrew stuff separate from nix but still "keep myself honest" with this:
HOMEBREW_NO_AUTO_UPDATE=1 /opt/homebrew/bin/brew bundle --file="$HOME/Brewfile" --cleanup --no-upgradeIt seems the clear barrier to entry to nix is UX and to an extent the custom language they use. Maybe this problem can be solved with LLMs. We need an LLM fine tuned to write nix language.