I’ve wrapped nix-darwin, home-manager etc in a Nix configuration for macOS, with a starter template and simple installer.<p>I’ve been running it for a couple years, you can use it to try Nix without as much up front learning.<p>Almost 1000 stars!<p><a href="https://github.com/dustinlyons/nixos-config">https://github.com/dustinlyons/nixos-config</a><p>Edit: Just crossed 1k! Thanks HN
(this prolly deserves its own blog post somewhere)<p>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 ...<p>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 ...<p>You instead add sourcing statements in your system/home files to bring in your nix files.<p>These sourcing statements are nuked after every OS upgrade so first time you login, nothing looks right in your shell.<p>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 ...<p>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 ...
I have all the love and appreciation in the world for enjoying a weekend spent in configuration files. But I feel the need to state the obvious:<p>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.
I tried setting up nix-darwin with home-manager, but it just made the system more confusing to operate. Ended up using home-manager standalone without flakes. Works like a charm.
Without reading the article: I've used Nix on macOS without nix-darwin or home-manager for some time now. I define my packages in a flake.nix that exports an environment and I use install using `nix profile`.
I could never get into nix on Mac os. Maybe it's a different thing if you use nixOS but I'm not willing to make that jump.<p>It 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.