How I restore my entire Mac user environment from one Git repo with a single command

I wrote earlier about why I use Nix on macOS. This is the follow-up: the same idea, applied to the whole machine instead of one project.

My entire user environment lives in a single Git repo. Packages, shell config, aliases, git, tmux, the editor. Everything I care about, basically. When I get a new Mac, I clone it, run one command, and I'm back.

The recipe is short:

Install Nix (the Determinate installer, more on that in a sec).