This is clone of https://github.com/mitchellh/nixos-config all basic documentation there.
I made some changes for my cases.
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate
# OR
make install
sudo nix run nix-darwin -- switch --flake /Volumes/SRC/nix-conf#mac-m4 --show-trace
# OR
make setup
sudo darwin-rebuild switch --flake /Volumes/SRC/nix-conf#mac-m4 --show-trace
# OR
make switch
# OR
make