Live data from Hacker News

I Use Nix on macOS

blog.6nok.org

1–10 of 18 posts

Re: I Use Nix on macOS

#4
There exists nix-darwin, which allows for installing and configuring graphical apps on macOS. However, in my experience the OS starts freaking out about permissions every time you build --switch. Something about changing around the symlinks to .app files confuses it and resets permissions and duplicates autostart entries and such, which unfortunately got me to give up on it.

Re: I Use Nix on macOS

#5
it's interesting to me that the author didn't spend much time on home-manager or flakes. home-manager is apparently too complicated for OPs workflow which I could kinda see for simple things. But reproducibility is one of the strongest selling points of nix.

So.. that being said, you can setup home-manager to install and configure things from git. Using flakes makes it more reproducible.

These means that you can just git clone and 'home-manager switch' and setup everything from scratch.

I do this on both mac and linux machines (ubuntu 20) and quite often use the same nix expressions.

I'd highly recommend that workflow, since it's git, you can do anything you want. Go back a month via git on a branch and make that machine exist again.

It really makes managing software fearless

Re: I Use Nix on macOS

#6
> nix run nixpkgs#cowsay

> This is a game-changer, you don’t have to pollute your system to run a one-off command, or you can try a package out before committing to installing it.

Is there a way to run the command isolated from the rest of the system? Because while this is nice it will still leave behind whatever configuration files / caches the program created on start up.

Re: I Use Nix on macOS

#7
post #6

> nix run nixpkgs#cowsay > This is a game-changer, you don’t have to pollute your system to run a one-off command, or you can try a package out before committing to installing it. Is there a way to run the command isolated from the rest of the system? Because while this is nice it will still leave behind whatever configuration files / caches the program created on start up.

you can run nix in a container

It's tricky because said program probably needs to access the original $HOME

Re: I Use Nix on macOS

#8
I’ve beeen using Nix on macOS for years now, and I don’t imagine ever going back. Declarative software management is the future. So easy to keep my dev environment up-to-date and quickly try out new packages. Never breaks.

Also, no more docker! docker on macOS was always a pain.

I made it easy for others to try if you’re interested, almost 800 stars now:

https://github.com/dustinlyons/nixos-config

Re: I Use Nix on macOS

#9
post #6

> nix run nixpkgs#cowsay > This is a game-changer, you don’t have to pollute your system to run a one-off command, or you can try a package out before committing to installing it. Is there a way to run the command isolated from the rest of the system? Because while this is nice it will still leave behind whatever configuration files / caches the program created on start up.

Not on macOS, but if you want run NixOS in a VM or on bare metal you can use nix-impermanence. Recreates your system/state from scratch on each reboot.

https://nixos.wiki/wiki/Impermanence

Re: I Use Nix on macOS

#10

There exists nix-darwin, which allows for installing and configuring graphical apps on macOS. However, in my experience the OS starts freaking out about permissions every time you build --switch. Something about changing around the symlinks to .app files confuses it and resets permissions and duplicates autostart entries and such, which unfortunately got me to give up on it.

I’ve been using Nix on Mac for a couple years now and haven’t seen this behavior. Just works.

Maybe mixing sudo / user permissions during initial installation broke it. Nix is pretty unforgiving with not great error messages.

Post reply on HN