-
I use home-manager on NixOS and currently manage my Neovim configuration using a traditional I would like to give My open question is: how do you work with Nix, home-manager, and I see there is a |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 17 replies
-
Hey 👋 The package in nixpkgs is currently a bit outdated, and I use the flake output mainly for testing during development. But here are some caveats to be aware of when using the nix derivation:
An alternate solution would be to add Something along the lines of this1: local rocks_config = {
rocks_path = vim.fn.stdpath("data") .. "/rocks",
luarocks_binary = "${pkgs.lua51Packages.luarocks}/bin/luarocks",
}
vim.g.rocks_nvim = rocks_config
local luarocks_path = {
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"),
}
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
local luarocks_cpath = {
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
}
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
if not vim.uv.fs_stat(rocks_config.rocks_path) then
vim.system({
rocks_config.luarocks_binary,
"install",
"--tree",
rocks_config.rocks_path,
"--server='https://nvim-neorocks.github.io/rocks-binaries/'",
"--lua-version=5.1",
"rocks.nvim",
}):wait()
end
vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "rocks.nvim", "*")) Some more important info:
Since I use NixOS myself, I am definitely very interested in creating a module or setup that makes it easier to use rocks.nvim with NixOS. You probably won't need gcc for tree-sitter parsers, because rocks.nvim fetches pre-compiled parsers from our rocks-binaries server. Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your detailed answer! I wouldn't mind going the way you suggest: providing bootstrapping dependencies with nix, and having neovim fetch rocks.nvim and set itself up. This is what I am already doing with lazy.nvim (I don't fetch lazy from nixpkgs). The README describes a very imperative approach to plugin configuration using |
Beta Was this translation helpful? Give feedback.
-
Hi, @mrcjkb. I'm a bit lost about your instruction. I have included the bootstrapping code you mentioned above and I also have these packages installed.
But when I install rocks through the script and paste the code you provided and start neovim I run into this error. Error detected while processing /home/star/.local/share/nvim/rocks/lib/luarocks/rocks-5.1/rocks.nvim/2.25.
1-1/plugin/rocks.lua:
E5113: Error while calling lua chunk: ...unwrapped-7f08477/share/nvim/runtime/lua/vim/_system.lua:244: ENO
ENT: no such file or directory
stack traceback:
[C]: in function 'error'
...unwrapped-7f08477/share/nvim/runtime/lua/vim/_system.lua:244: in function 'spawn'
...unwrapped-7f08477/share/nvim/runtime/lua/vim/_system.lua:335: in function 'system'
...r/.local/share/nvim/rocks/share/lua/5.1/rocks/loader.lua:7: in function 'get_luarocks_lua_dir_f
rom_luarocks'
...r/.local/share/nvim/rocks/share/lua/5.1/rocks/loader.lua:18: in function 'enable'
.../luarocks/rocks-5.1/rocks.nvim/2.25.1-1/plugin/rocks.lua:29: in main chunk |
Beta Was this translation helpful? Give feedback.
-
Out of curiosity @mrcjkb, as a Nix and Neovim user yourself, what is your personal setup for your own day to day neovim instance? Do you use You said earlier that the average user is your current target, but I am also curious to know what you envision would be the longer term approach to ease usage of |
Beta Was this translation helpful? Give feedback.
-
For those looking for a concrete example, this is how I configured my neovim I import that into my home-manager config. Then run the imperative install command,
making sure to set Not a perfect solution but just pre-pends the configuration above to init.lua. |
Beta Was this translation helpful? Give feedback.
Hey 👋
The package in nixpkgs is currently a bit outdated, and I use the flake output mainly for testing during development.
In principle, you could use the
neovim-with-rocks
derivation (which I use for testing) as a basis for setting up rocks.nvim with a nix/home-manager managed neovim.But here are some caveats to be aware of when using the nix derivation:
If you don't remove that entry, it'll install the rocks.nvim lua package, and you'll have two conflicting installations.
One in the nix store, and one managed by rocks.nvim.