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.
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:
A lot of opinions on Nix here, but I manage a declarative configuration on my Mac that I now couldn’t live without. I have step by step instructions if you want to try it yourself. Many other folks have told me they find it useful too (almost 700 stars):
I would argue the benefit is also it’s declarative, done forever, and your machine becomes relatively bulletproof.
Dev environment issues are a thing of the past, once you’ve defined your configuration.
If something is broken with a package, I don’t have to figure it out myself —- I just rollback, wait for someone to fix it upstream in nixpkgs and pull down the patch later.