Hello,
I’m trying to set up my existing Lua config for Neovim through home-manager
.
I am using the programs.neovim.extraLuaConfig
for the basic config, then programs.neovim.plugins
to manage the plugins. For each plugin that has a specific config, I create a separate Lua file, and use builtins.readFile
to access it in the home-manager
config.
For example, with mason-lspconfig.nvim
:
- In
home.nix
:
programs.neovim.plugins = with pkgs.vimPlugins [
[...]
nvim-lspconfig
{
plugin = mason-nvim;
type = "lua";
config = builtins.readFile(./nvim/plugins/mason.lua)
}
{
plugin = mason-lspconfig-nvim;
type = "lua";
config = builtins.readFile(./nvim/plugins/mason-lspconfig.lua)
}
[...]
];
- In
mason.lua
:
require("mason").setup()
- In
mason-lspconfig.lua
:
require("mason-lspconfig").setup() {
ensure_installed = {
"lua_ls",
"clangd",
"marksman",
"nil_ls",
"jedi_language_server",
"svelte",
"taplo",
"yamlls",
"bashls",
},
}
- In turn generating the following lines in
init.lua
:
[...]
require("mason").setup()
require("mason-lspconfig").setup() {
ensure_installed = {
"lua_ls",
"clangd",
"marksman",
"nil_ls",
"jedi_language_server",
"svelte",
"taplo",
"yamlls",
"bashls",
},
}
However, for some unknown reason, the line require("mason-lspconfig").setup()
throws out an error, saying attempt to call a nil value
, as if the package was not installed.
Thank you for any help provided !