With this flake repo, you can get NixOS-like experience on macOS.
Use the nix-installer is the most robust way to install Nix on macOS.
nix-darwin needs to be installed first.
It is important to add the nix.settings.trusted-users
config to the nix-darwin config file before running this flake.
Note that nix-darwin will override the Nix version installed in the previous step. As of 22-07-2024, nix-darwin can not bootstrap without Nix installed first.
Once the preparation steps are done, you can get NixOS experience (managing software and services declaratively with Nix) on your macOS with this flake repo.
nix run .#update
nix run .#activate
The source code of the template is nixos-flake
Also see nixos-unified