Documentation
The easiest way to install Nix, with the correct configuration, is to run:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \ sh -s -- install
You can also follow the instructions on the Nix website instead, though note that you will then need to also enable flakes manually. You can do that by adding the lines:
experimental-features = nix-command flakes
To ~/.config/nix/nix.conf (for your user) or /etc/nix/nix.conf (globally).