Nix config with NixVIM error on build

My Nixvim config keeps throwing an error when I try to build it. Commenting it the config builds cleanly.

Any help / ideas would be greatly appreciated

the error is:

Module `:anon-8:anon-1’ has an unsupported attribute `enable’. This is caused by introducing a top-level `config’ or `options’ attribute.

The config itself is like this:

imports = [
  inputs.nixvim.homeManagerModules.nixvim
];

programs.nixvim = {
  enable = true;
  globals.mapleader = " ";
  options.number = true;
  options.relativenumber = true;

programs.nixvim.config = {
  colorschemes = {
  catppuccin = {
  settings = {
  flavour = “mocha”;
        };
      };
    };
  };
};


In the code you’ve posted the nesting isn’t right so it has tried to set programs.nixvim.programs.nixvim.config, which doesn’t exist.

Also I believe that it should be programs.nixvim.opts rather than options.

Does this build?

programs.nixvim = {
  enable = true;
  globals.mapleader = " ";

  opts = {
    number = true;
    relativenumber = true;
  };

  colorschemes.catppuccin = {
    enable = true;
    settings.flavour = “mocha”;
  };
};

darn… somehow I did not pick up on that… happens when staring at code for ages I guess.

Thanks @anon40720877

It absolutely does, at least for me too!