Cannot use git submodule in home-manager home.file

Hi, I recently installed Nix to a Mac machine with Deterministic System’s nix-installer, then home-manager in standalone flake mode into its own folder (~/dotfiles).

I then attempted to add my nvim config into the home-manager configuration by adding the nvim repository to ~/dotfiles as a git submodule (by just manually running git submodule add <url> dotnvim), then adding these lines to my home.nix:

  home.file = {
    "./config/nvim" = {
      source = ./dotnvim;
      recursive = true;

Then running home-manager switch --flake ~/dotfiles afterwards.

However, apparently the submodule is not copied into nix for whatever reason and I get this error:

error: getting status of '/nix/store/ki5lpcwgvhqg97in4cff03pv5cf8d5hw-source/dotnvim': No such file or directory

Additionally, I also tried copying all the files out of the submodule into just a normal directory just to see whether it would work, and while the home-manager command seems to work, the ~/.config/nvim symbolic link is not created as I would expect.

After changing to normal directory run git add -A
I’m not sure but maybe recursive is not necessary