Hello again! I’m trying to set up Nixvim on my computer. Right now I have normal Neovim installed (through home-manager) with plugins courtesy of lazy.nvim, and I’m planning on switching from that to Nixvim so that it’s all Nix. When building I get an error saying that an “attribute ‘map’” is “missing”.
Here’s the log file for nixos-switch:
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/attrsets.nix:1541:11:
1540| || pred here (elemAt values 1) (head values) then
1541| head values
| ^
1542| else
… while evaluating the attribute 'value'
at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute 'map' missing
at /nix/store/vs825kzqcls3f35kpidzi5x14gs0syc2-source/plugins/none-ls/sources.nix:10:38:
9| ++ (lib.flatten (
10| lib.mapAttrsToList (category: (lib.map (mkSourcePlugin category))) noneLsBuiltins
| ^
11| ));
Did you mean one of imap, max, imap0, imap1 or min?
I’m barely used to flakes and home-manager, although I do have both set up. I switched from using flakes to install Nixvim to using my config in the home directory after I came across the same error. I’m new to Nix and NixOS in general, but if my eyes don’t decieve me then the code the error’s referencing is source code. I’m hoping there’s a way to fix it, but if not I’ll switch to using home-manager to configure Neovim.
It looks like you’re using an outdated Nixpkgs version, updating should fix it . In particular, the error is saying that lib.map doesn’t exist, which was only introduced recently (also backported to the 24.05 release), and Nixvim started relying on that.
I wasn’t aware the lib aliases for builtins were only added recently, in June. That explains a few issues we ran into in nixvim!
I guess I assumed that since some builtins started off as nixpkgs lib functions before being promoted to builtin status, that all builtins had an alias in lib.
That either can’t be it or my system is lying to me. I appear to be on 24.05, and before trying to set up Nixvim, I even added the unstable channel because Nixvim’s documentation said so.
Here’s the output of nix-info -m:
24.05 keeps changing as people backport changes to it. It looks like you’re using a version from March (the 20240329 gives the date), which indeed doesn’t contain lib.map yet.
While I’m not a fan of nix-channel, you should be able to update to the latest 24.05 revision using sudo nix-channel --update
Well… actually, I take that back. You should probably have only one nixpkgs channel — the one that belongs to root. Do you happen to have any user channels? Try nix-channel --list.
That command outputs nothing, so I’m assuming no, I don’t have any user channels.
I should point out I’m moving my current Neovim config from using lazy.nvim to using home-manager instead. I’ll probably just use that instead of Nixvim if this ends up being unfixable.
I removed the channel nixos-unstable, but Nixvim still isn’t installing.
I think I’ve had the problem of NixOS refusing to update properly for a while now. It couldn’t install zed-editor and just today I tried putting nodejs_22 in my config, only for it not to recognize it as a package.