I don’t keep my config in
/etc/nixos/configuration.nix, it just includes other files and has the stateversion so it isn’t tracked in git. I use stow to manage my dotfiles and I keep my nix configuration in the same repo, though I may move it to it’s own repo. Stow is used to symlink the configuration. nixpkgs is currently a submodule in that repository and that is how I pin it, I’m not a big fan of that but I don’t know of anything better for me.
On a new machine I do the following (c/p from repo):
git clone firstname.lastname@example.org:borisbabic/dotfiles.git --recurse-submodules /etc/nixos/dotfiles # or using https git clone https://github.com/borisbabic/dotfiles.git --recurse-submodules /etc/nixos/dotfiles
cp nixos/configuration.nix.skel /etc/nixos/configuration.nix
vim /etc/nixos/configuration.nix #choose what you want, and update the state version to a newer one if avilable
sudo nixos-rebuild switch