A dir managed by HM get deleted on reboot

I am managing my doom config dir with home manager. It lives in ~/.config/doom. It gets deleted every time I reboot my system.

{
  pkgs,
  lib,
  config,
  xdg,
  ...
}:
{
  

  options = {
    my.emacs.enable =
      lib.mkEnableOption "enables emacs";
  };

  config = lib.mkIf config.my.direnv.enable {
    programs.emacs.enable = true;

    ...

      xdg.configFile."doom" = {
      enable = true;
      source = ./doom-emacs;
      recursive = true;
    };
  };
}

I have also tried sourcing the directory as a package in src in mkDerivation and indirectly as part of a the install phase in a fetchurl. They all work. However when I reboot the directory disappears.

I have another config for Neovim where I move a dir into the .config dir. This does not get deleted on boot.

{
  pkgs,
  config,
  fetchFromGitHub,
  ...
}:
{
  # https://www.reddit.com/r/NixOS/comments/13uc87h/masonnvim_broke_on_nixos/
  programs.neovim.enable = true;


  home.sessionVariables = {
    EDITOR = "nvim";
  };

  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
    '';
  };
}

I am using a flake.
My config is in my NixOS config on github.

This was not a bug with home manager. It was a result of the way I boot my PC.
Some times my PC crashes or I reboot with a hardware switch it removed the UEFI entry in the bios. Therefor I began to use Mint OS’s Grub menu. This lead to me booting into the same wrong generation over and over again. I do not know why the boot entry gets removed. However that is another issue altogether.