Attribute 'map' missing when setting up Nixvim

If you’re using a flake, you should follow the flake installation instructions. It seems you’re using the non-flake instructions.

https://nix-community.github.io/nixvim/

It looks like your infinite recursion is caused by using pkgs to define the nixvim that you’ll presumably use in your imports.

Because pkgs is defined as part of config._module.args, it cannot be used in module imports because that is evaluated before config is ready.

Do you mean the pkgs in nixvim = import (pkgs.fetchgit {});? If so, how else do I import it?

Or is the best solution just to switch to flakes? I feel like a lot of the mess I’ve gotten into with this is because I used the direct import instead of just using my flake.

Matt already provided the instructions and the explanation, did you try following what was given?

Ive run into the same initial error as OP when following this guide.. Specifically Did you mean one of imap, max, imap0, imap1 or min?. Thus far, none of the replies have fixed the issue.

As an aside, the nixvim docs could use some more clarity around installation for newcomers, especially as vim is one of the first things one installs on a system in order to further investigate nix

1 Like

Well you have to share your code (your config) as tlemo did above. we cannot divine what you did incorrectly.
IMO the instructions in the repo are as clear as possible, so if you misunderstood something you have to show us what you did for us to point it out.

I found the fix for this. I had to run nix flake update from my home manager directory root. It must have been a stale version or something. Once I ran this the Did you mean one of imap, max, imap0, imap1 or min? was resolved

That’s basically the same answer that was given at the top.
(That implies you haven’t updated your inputs in over 3 months, btw)

So (by following the guide MarlieChiller provided, I couldn’t infer it from the docs), I got a setup that looks correct:

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

# in dotfiles/main.nix imports
inputs.nixvim.homeManagerModules.nixvim

This code, however, returns this error file:

error:
       … while calling the 'seq' builtin

         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/home/tlemo/dotfiles/nixos/programs': No such file or directory

Probably forgot to git-add

Git add what? My main.nix is already added.

The path mentioned in the error that you posted.

My brain cells are fried from this, sorry. I thought this was some weird internal error, but I actually needed to make the programs directory. Now it’s asking for a programs/default.nix file, what do I put here?

Whatever you wanted to? You presumably have an imports entry pointing at that path so whatever you wanted to import from there.

1 Like

I see the problem. I took ./programs from the guide and put it in my imports thinking it was important. It was just the guide author’s personal config stuff. Again, my bad.
Regardless, my system rebuilds with no errors. I ran into the same error as @MarlieChiller did, and I fixed it by running the same command he did. But oddly enough my graphics card doesn’t work now? It isn’t enabled by Nix it appears. When I updated my flake it rejected a setting under hardware.opengl, and it appears the whole option got renamed.
I’ll get back to this thread once I get my graphics fixed up.

Alright, I guess my computer actually, for real this time, updated. My hardware acceleration being turned off was just my computer browning out after updating, and restarting fixed it.
Anyways, it works now. Changing my theme to Kanagawa via Nixvim works flawlessly. Thank you to everyone who helped me with this. There isn’t really a single reply here that outlines what to do, so I’ll run down what I did to get Nixvim set up (for people who are using flakes and are running into the same issue as I):

  1. In flake.nix, put Nixvim in your inputs as the docs describe, and make sure to put it in the modules of the outputs (nixvim in outputs = { self, nixpkgs, nixvim, ... })
  2. In your system config (or whichever config you wish) put inputs.nixvim.nixosModules.nixvim in your inputs, then somewhere put programs.nixvim.enable = true;

I agree with MarlieChiller personally, the docs don’t reveal this information at all, at least not in a way that newcomers like me can intuit. It just drops <nixvim>.nixosModules.nixvim and tells you to replace <nixvim> with “the way to access nixvim”, which I didn’t understand meant the variable defined by your flake inputs (or by let, I assume).
…Or this is just standard Nix and I’m just starting to understand it all. Regardless, thanks.