The nixos.org website suggests to use:
sh <(curl -L https://nixos.org/nix/install)
For macOS on Intel (x86_64) or Apple Silicon (arm64) based macs, we need to use
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
That's it!
Now we can use nix
as usual:
nix build -L '(import <nixpkgs> {}).hello.overrideAttrs (_: { HELLO = "WORLD"; })'
or
nix-shell -p haskell.compiler.ghc882
should just work.
A note on arm64: I think you need to ensure you have rosetta installed first and the installer doesn't trigger it. I tried it prior to installing anything else and it failed but after installing a browser which triggered the rosetta install this worked.