There’s an open PR to nix to allow for disabling this restriction: Add option to include untracked files in git and mercurial fetchers by jfroche · Pull Request #9352 · NixOS/nix · GitHub
You could build nix yourself with this patch included.
Be aware though, you might end up accidentally importing big files into your store (like if you have a .qcow2 image from a VM run lingering around in your source dir).