Faced the infinite recursion encountered an error during the nixvim install

HI,

I configure the nixos using Flake and Home Manager. When I installed nixvim, I faced the following error: infinite recursion was encountered.

My nixos configuration looks like this.

flake.nix file :

{
  description = "Nixos config flake";

   inputs = {
  
    # Nix Pkgs
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    
    # Home Manager 
    home-manager = {
       url = "github:nix-community/home-manager";
       inputs.nixpkgs.follows = "nixpkgs";
    };

    # Nixvim 
    nixvim = {
        url = "github:nix-community/nixvim";
        inputs.nixpkgs.follows = "nixpkgs";
    };

  };

 outputs = { self, nixpkgs, home-manager, nixvim, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
       nixosConfigurations.default = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs; };
          modules = [ 
            ./configuration.nix
          ];
       };
      
      homeConfigurations.default = home-manager.lib.homeManagerConfiguration {
        useGlobalPkgs = true;
        useUserPackages = true;
        inherit pkgs;
        modules = [
          ./home.nix
          nixvim.homeManagerModules.nixvim # try this way
        ];
        extraSpecialArgs = { inherit inputs; inherit nixvim; };
    };

   };
}

home.nix file :

{config, pkgs, inputs, nixvim, ... }:
{
  

# import nixvim here. 

  imports = [
    nixvim.homeManagerModules.nixvim
  ];

 # use it

  programs.nixvim = true;


# ^^^

  home.username = "officialrajdeepsingh";
  home.homeDirectory = "/home/officialrajdeepsingh";

  home.stateVersion = "23.11"; # Please read the comment before changing.

  # Allow to install unfree package in nixos.
  nixpkgs.config.allowUnfree = true;

  # Using mismatched versions nixos and home manager.
  home.enableNixpkgsReleaseCheck = false;

  home.packages = with pkgs; [
    turso-cli
    google-chrome
    tor-browser
    brave
    notesnook
    rustup
    lua
    zig
    python3
    nodejs_20
    deno
   # ...
  ];

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

 programs.home-manager.enable = true;

}

hey, was this fixed?

  1. Import it only once.
  2. programs.nixvim.enable = true, not programs.nixvim = true.

Also don’t useGlobalPkgs = true; in the standalone HM config, you mixed settings…