Configure NvChad with home manager

Hi, I am trying to configure NvChad with home manager. I can fetch the GitHub repo but I cannot inject my own configurations afterwards. My code is separated into its own file. The file is.

  programs.neovim.enable = true;

  xdg.configFile."nvim".source = pkgs.fetchFromGitHub {
  owner = "NvChad";
  repo = "NvChad";
  rev = "f17e83010f25784b58dea175c6480b3a8225a3e9";
  hash = "sha256-P5TRjg603/7kOVNFC8nXfyciNRLsIeFvKsoRCIwFP3I=";

  xdg.configFile."nvim/lua/custom/".source = ./my_nvchad_config;
  xdg.configFile."nvim/lua/custom/".recursive = true;

the error I get when running the code is:

warning: Git tree '/home/rasmus/Documents/nix-config' is dirty
error: builder for '/nix/store/9wysk7sl5g1wqla5fvhcdid586xl7fn4-home-manager-files.drv' failed with exit code 1;
       last 1 log lines:
       > Error installing file '.config//nvim/lua/custom/' outside $HOME
       For full logs, run 'nix log /nix/store/9wysk7sl5g1wqla5fvhcdid586xl7fn4-home-manager-files.drv'.
error: 1 dependencies of derivation '/nix/store/8g3qyiynq30ysx8cy49ic0iyykm9nil5-home-manager-generation.drv' failed to build

Is there anything I can do?

I got it to work by using pkgs.stdenv.mkDerivation and injecting the code in the install phase. The code became.

  programs.neovim.enable = true;

  xdg.configFile."nvim".source = pkgs.stdenv.mkDerivation {
    name = "NvChad";
    src = pkgs.fetchFromGitHub {
      owner = "NvChad";
      repo = "NvChad";
      rev = "f17e83010f25784b58dea175c6480b3a8225a3e9";
      hash = "sha256-P5TRjg603/7kOVNFC8nXfyciNRLsIeFvKsoRCIwFP3I=";
    installPhase = ''
    mkdir -p $out
    cp -r ./* $out/
    cd $out/
    cp -r ${./my_nvchad_config} $out/lua/custom

my nix directory is

├── my_nvchad_config
│   ├─ **
└── neovim.nix

This works and puts all the files in the correct place. However, I apperently cannot use the normal way of configuring neovim because of the way Nixos is set up.