In a recent thread jonringer explained how to rebuild a NixOS system from the directory of a local copy of nixpkgs. I haven’t tried it myself yet but it might help
You can apply changes locally by doing, sudo nixos-rebuild -I nixpkgs=$PWD switch , or use path urls if you are using flakes.