[BUG] attempt to call field 'joinpath' (a nil value)
| Field | Description |
|---|---|
| Plugin | NixVim |
| Nixpkgs | 24.05 |
| Home Manager | 24.05 |
- [X] I have read the FAQ and my bug is not listed there.
Description
I get error
Error detected while processing /home/user/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/user/.config/nvim/init.lua:43: attempt to call field 'joinpath' (a nil value)
stack traceback:
/home/user/.config/nvim/init.lua:43: in main chunk
this is part of init.lua managed by nixvim.
Minimal, Reproducible Example (MRE)
{
programs.nixvim = {
enable = true;
defaultEditor = true;
opts = {
number = true;
relativenumber = true;
shiftwidth = 2;
clipboard = [ "unnamedplus" ];
};
globals.mapleader = " ";
colorschemes.base16 = {
enable = true;
colorscheme = "tokyo-night-storm";
};
plugins = {
lsp.enable = true;
cmp.enable = true;
lualine.enable = true;
undotree.enable = true;
cmp-path.enable = true;
nvim-tree.enable = true;
telescope.enable = true;
autoclose.enable = true;
treesitter.enable = true;
bufferline.enable = true;
copilot-vim.enable = true;
which-key = {
enable = true;
settings = {
icons = {
breadcrumb = "»";
separator = "➜";
group = "+";
};
layout = {
height = { min = 4; max = 150; };
width = { min = 20; max = 950; };
spacing = 3;
align = "left";
};
};
};
};
extraConfigLua = ''
local status, wk = pcall(require, "which-key")
if not (status) then
vim.notify("couldn't load whichkey, skipping mappings")
return
end
-- normal mode
local which_key_map = {}
-- general
which_key_map['s'] = { '<Cmd>w<CR>', 'Save file' }
which_key_map['S'] = { '<Cmd>wa<CR>', 'Save all' }
-- Tree
which_key_map['e'] = { vim.cmd.NvimTreeToggle, 'Tree' }
-- Undotree
which_key_map["u"] = { vim.cmd.UndotreeToggle, 'Undo tree' }
-- Git
-- which_key_map['g'] = { vim.cmd.Git, 'Git' }
-- LSP
which_key_map['l'] = { vim.cmd.LspInstall, 'LSP installer' }
-- Format buffer
which_key_map['f'] = { vim.lsp.buf.format, 'Format buffer' }
-- Replace the word I'm on
which_key_map['r'] = { [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], 'Replace' }
-- Sourse from current file
which_key_map[' '] = { function() vim.cmd('so') end, 'Sourse from file' }
-- Barbar
which_key_map.b = {
name = '+Buffer',
b = { '<Cmd>BufferNext<CR>', 'Next buffer' },
m = {
name = '+Move buffer',
a = { '<Cmd>BufferMovePrevious<CR>', 'Move back' },
e = { '<Cmd>BufferMoveNext<CR>', 'Move forvard' },
},
f = { '<Cmd>BufferGoto 1<CR>', 'Go to first' },
l = { '<Cmd>BufferLast<CR>', 'Go to last' },
q = { '<Cmd>BufferClose<CR>', 'Close current' },
o = { '<Cmd>BufferCloseAllButCurrent<CR>', 'Close all but current' },
u = { '<Cmd>BufferCloseBuffersLeft<CR>', 'Close left' },
d = { '<Cmd>BufferCloseBuffersRight<CR>', 'Close right' },
s = {
name = '+Sort',
n = { '<Cmd>BufferOrderByBufferNumber<CR>', 'By buffer number' },
l = { '<Cmd>BufferOrderByLanguage<CR>', 'By language' },
d = { '<Cmd>BufferOrderByDirectory<CR>', 'By directory' },
w = { '<Cmd>BufferOrderByWindowNumber<CR>', 'By window number' },
}
}
-- Telescope
local builtin = require('telescope.builtin')
which_key_map.t = {
name = 'Telescope',
f = { builtin.find_files, 'Search file' },
-- Treesitter playground
p = { vim.cmd.TSPlaygroundToggle, 'Treesitter playground' },
s = { function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end, 'Grep' },
g = { builtin.git_files, 'Git files' },
}
-- Packer
which_key_map.p = {
name = 'Packer',
s = { vim.cmd.PackerSync, 'Synchronise' },
c = { vim.cmd.PackerCompile, 'Compile' }
}
which_key_map['x'] = { '<Cmd>q<CR>', 'Quit file' }
which_key_map['X'] = { '<Cmd>qa<CR>', 'Quit all' }
which_key_map['q'] = { '<Cmd>wa<CR><Cmd>qa<CR>', 'Save quit all' }
which_key_map['Q'] = {
string.format('<Cmd>wa<CR><Cmd>mksession! %s/Session.vim<CR><Cmd>qa<CR>', vim.fn.getcwd()),
'Save session quit all',
}
wk.register(which_key_map, { prefix = '<leader>' })
-- Move selected text vertically
vim.keymap.set("v", "E", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "O", ":m '<-2<CR>gv=gv")
-- Leave cursor in place when join the lines
vim.keymap.set("n", "J", "mzJ`z")
-- Replace highlighted word and keep it to yank
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set( "n", "'e", "<Cmd>TmuxNavigateDown<cr>")
vim.keymap.set( "n", "'o", "<Cmd>TmuxNavigateUp<cr>")
vim.keymap.set( "n", "'i", "<Cmd>TmuxNavigateRight<cr>")
vim.keymap.set( "n", "'a", "<Cmd>TmuxNavigateLeft<cr>")
vim.keymap.set( "n", "'/", "<Cmd>TmuxNavigatePrevious<cr>")
'';
};
}
}
Are you using nixvim's unstable (main) with nixpkgs 24.05?
I think your error comes from nvim being 0.9 while nixvim is writing a config targeting 0.10.
You may be able to resolve by either using nixvim's nixos-24.05 branch or by setting programs.nixvim.nixpkgs.pkgs to a suitable unstable nixpkgs instance.
Are you using nixvim's unstable (
main) with nixpkgs 24.05?
I use only nixpkgs 24.05
I think your error comes from nvim being 0.9 while nixvim is writing a config targeting 0.10.
yes, I have nvim 0.9
You may be able to resolve by either using nixvim's
nixos-24.05branch or by settingprograms.nixvim.nixpkgs.pkgsto a suitable unstable nixpkgs instance.
I don't understand how it can use nvim 0.10 as in my config I have only 24.05 version. here is link to my config NixOS conf, maybe I missed something
You need to use the 24.05 branch of nixvim
You may be able to resolve by either using nixvim's
nixos-24.05branch or by settingprograms.nixvim.nixpkgs.pkgsto a suitable unstable nixpkgs instance.
As above :point_up_2:
You can either:
- Use nixim's
nixos-24.05branch (easiest option) - Create a pkgs instance from
nixos-unstableand use it asprograms.nixvim.nixpkgs.pkgs - Use nixvim's "standalone build" installation method
As above 👆
You can either:
* Use nixim's `nixos-24.05` branch (easiest option)
with this modification
nixvim = {
url = "github:nix-community/nixvim";
# If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-<version>"`
inputs.nixpkgs.follows = "nixpkgs";
};
now I get this error
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'home-manager-generation'
whose name attribute is located at /nix/store/mvz96grv31nxq69ldw5a5pn2qh1s6ca6-source/pkgs/stdenv/generic/make-derivation.nix:333:7
… while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
at /nix/store/mvz96grv31nxq69ldw5a5pn2qh1s6ca6-source/pkgs/build-support/trivial-builders/default.nix:68:16:
67| enableParallelBuilding = true;
68| inherit buildCommand name;
| ^
69| passAsFile = [ "buildCommand" ]
(stack trace truncated; use '--show-trace' to show the full trace)
error: eslint cannot be found in pkgs
That'll be because your config was written for nixvim's unstable branch.
error: eslint cannot be found in pkgs
This means pkgs.eslint doesn't exist in 24.05.
If you want to use nixvim's stable branch, you can reference our stable docs at https://nix-community.github.io/nixvim/stable/
If you'd rather mix-and-match; using 24.05 for your main config, but nixos-unstable for your nixvim build, you can see my alternative solution in my earlier comments 🙂
error: eslint cannot be found in pkgs That'll be because your config was written for nixvim's unstable branch.
I have encountered this problem too because needed new fancy extraFiles.
Just curious, how it's come to a strong dependency on the ecmascript's linter? I doubt any evaluations there actually needed to happen at least without enabling any LSP-related plugins as it is in my case.
… while calling anonymous lambda
at /nix/store/7habycwl6g3cpnjb3m16azypx4wxyli0-source/plugins/lsp/language-servers/efmls-configs.nix:46:12:
45| (lib.attrsets.mapAttrs (
46| _: opt:
| ^
47| if lib.meta.availableOn pkgs.stdenv.hostPlatform opt.default then
… from call site
at /nix/store/7habycwl6g3cpnjb3m16azypx4wxyli0-source/plugins/lsp/language-servers/efmls-configs.nix:47:12:
46| _: opt:
47| if lib.meta.availableOn pkgs.stdenv.hostPlatform opt.default then
| ^
48| opt
… while calling 'availableOn'
.....
error: eslint cannot be found in pkgs
You may be able to resolve by either using nixvim's
nixos-24.05branch or by settingprograms.nixvim.nixpkgs.pkgsto a suitable unstable nixpkgs instance.As above 👆
You can either:
- Use nixim's
nixos-24.05branch (easiest option)- Create a pkgs instance from
nixos-unstableand use it asprograms.nixvim.nixpkgs.pkgs- Use nixvim's "standalone build" installation method
Thanks, i had the same issue and this fixed it
Just curious, how it's come to a strong dependency on the ecmascript's linter? I doubt any evaluations there actually needed to happen at least without enabling any LSP-related plugins as it is in my case.
We have an issue regarding this https://github.com/nix-community/nixvim/issues/2004. Essentially, all package-options in nixvim end up having their default value evaluated for one reason or another. If pkgs.<some-packgae> doesn't exist in the current pkgs instance we run into errors like this.
Ideally, all nixvim's options would only evaluate their value/default-value when it's actually needed for something. But currently that isn't the case and we aren't 100% sure why.
We haven't had confirmation from the OP, but I'm going to assume this is resolved and close the issue.
If OP or anyone else still has anything to add, or thinks we should re-open, you will still be able to comment here.