Error: Getting status of '/mnt/nix/store/[...]-source/pkgs': No such file or directory

I am trying to install my NixOS configuration to a virtual machine. It works fine on my already-installed system, but when I try to install it to the VM, I get an error I cannot figure out:

Also, I doubt the the disko trace warning at the top is related.

as you are using flakes with a dirty git index, is that folder by chance a new folder that you did not add to the git index? If yes you might want to add that to the index.

No, that’s because at the time I updated hardware-configuration.nix for the VM, but neglected to commit it. There were no untracked files.

Thank you, though.

Okay, so after noticing the hash of the missing file in the error does not change after updating I looked up the hash on GitHub, and apparently it’s linked to files not being found because they are untracked.

However, the pkgs directory in my flake is tracked in my dotfiles repo. It contains an overlay in its default.nix file that I am trying to import into flake.nix and for some reason, this works on my system, just not when installing NixOS. In case it matters, I am using a custom install script rather than running nixos-install manually.

It occurs to me, I probably should have mentioned more details about my config up front.

Edit: Also, I should mention I am not sure what to do about this other than refactoring to remove the pkgs directory.