Start by running the nix installer script:
sh <(curl -L https://nixos.org/nix/install) --daemon
In order to use flakes, you need to allow two experimental features:
mkdir ~/.config/nix
echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf