Hacker News new | ask | show | jobs
by davidpfarrell 783 days ago
(this prolly deserves its own blog post somewhere)

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 ...

1 comments

Have you tried using the Determinate Systems installer? This (supposedly) helps to not break everything on system updates. As far as I can tell, it works.
It adds a launchd service that makes sure stuff sourcing your Nix environment setup script is present in all your shell units on boot, so they get reestablished when macOS updates nuke them.

macOS apps do weird shit to work around macOS quirks. But it's a really good installer. Can't recommend it enough.

Interesting. Good to know!