-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Lua Rocks Support #253
Comments
Thank you for the suggestion, but I'm not planning luarocks support |
btw, |
See also neovim/neovim#14871 |
@folke Can you please elaborate why you are against supporting luarocks? |
@tzachar because I never needed that ever |
Will you be open to accepting PRs to add support for lua rocks? |
Give me one good use case? And why would there need to be support for that in lazy.nvim directly? You can still use lua-rocks and add the lua-rocks path to the rtp no? |
When you want to use some data structure in a plugin, and dont want to include the code in the plugim itself?
Its easier to pull dependencies from a single place. And as packer supports luarocks, there are clearly other use cases. Wdyt? |
I haven't seen a single plugin that has lua-rocks dependencies. I'm not interested in adding or merging a PR to add lua-rocks functionality. This would only increase complexity and possibly introduce bugs for something that would never be used. |
Support for luarocks may be as simple as: -- Assuming that `package.path` is set from `$ luarocks path` command
os.execute("luarocks install " .. plugin.name)
Packer provides support for it but it's a bit complicated. |
I think we've got ourselves a bit of a vicious cycle. Plugins don't use LuaRocks because Neovim and plugin managers don't support it (packer uses hererocks for LuaRocks support, which based on my tests can't fetch dependencies). And the LuaRocks bundle is too large to bundle with Neovim (although the bits needed to install packages may be smaller). Plugin managers don't support LuaRocks properly because there aren't enough plugins that use it. The status quo:
I'm aware of an attempt at creating a neovim package specification, which may help alleviate some of these problems. But why reinvent the wheel? Nix will install the LuaRocks package (including its dependencies) if a neovim plugin is available on LuaRocks. It'll also install dependencies if it finds a rockspec in the source repo. I would be happy to see LuaRocks become the standard way of installing Neovim plugins. In the meantime, I will be doing my part in attempting to get plugins on LuaRocks with the luarocks-tag-release action. |
@mrcjkb Adding a builtin luarocks is a bit overkill regarldess of the way it's going to be used lol. I've system wide installation of the former and I don't even think about fetching tonnes of the hererocks and the rest nonse. For the rest, the |
Agreed that a built-in LuaRocks or a bundle would probably be overkill. It might not be that simple for plugin managers to just shell out to a system installation. What if someone has LuaRocks configured to use Lua 5.4? Then a system installation would refuse to install any Neovim plugins that expect Lua 5.1/LuaJIT. |
I know that this is not the place to consider these issues, so sorry for venting my frustrations :) I have to say that @mrcjkb summed the issue perfectly. From my viewpoint, as a plugin writer, every time I need to implement a new feature I have to consider the benefits of using any data structure against the implications of having to (a) find a stand alone implementation or implement it myself and (b) perpetually maintaining said implementation. The end result is that all of nvim's plugins end up underperforming and are less maintainable. We all lose as a result. |
This should be solved at plugin level. Neovim is run by using |
This will not run luarocks with Neovim's LuaJIT bundle as the interpreter. |
What's wrong with adding You could also specify an arbitrary URL but I'm not sure how well that would work. |
This issue has come up in my I'm adding this here to show there are definitely some use cases that aren't easily accommodated without lua rocks support and to see if there's maybe something I haven't considered that would make installing my plugin with |
@jghauser something you could try as a workaround is to find out how to build It's an ugly hack but it might work for some rocks. |
Thanks @mrcjkb! I will give this a try ❤️ |
I remember packer had this feature but never used it. Thanks to lazy.nvim's awesomeness and the power of git and GitHub I easily created a new repo where I added the lua fun library into a Then I add it as a plugin in the normal way with lazy.nvim |
@derekthecool I went even further: I just copy-pasted some of the code into my snippets/config files. Done. |
Speaking of luafun, plenary has a module that mimics luafun. I know that the plugin is kinda alpha, but it's used successfully in other plugins nonetheless. Also, NeoVim 0.10 will have iterators builtin! See neovim/neovim #23029 |
For installing luarocks when using lazy.nvim you can use the following plugin: https://github.com/camspiers/luarocks Example plugin spec for lazy.nvim: {
"camspiers/luarocks",
dependencies = {
"rcarriga/nvim-notify", -- Optional dependency
},
opts = {
rocks = { "fzy" } -- Specify LuaRocks packages to install
}
} You just need to customize When a particular luarock is needed by another plugin, make sure the specify As an example, the plugin require("lazy").setup({
{
"camspiers/luarocks",
dependencies = { "rcarriga/nvim-notify" },
opts = { rocks = { "fzy" } },
},
{
"camspiers/snap",
dependencies = { "camspiers/luarocks" },
}
}) |
@camspiers nice! But you might want to consider renaming (or joining forces). There's already a rocks.nvim plugin. |
@mrcjkb hmm, interesting, cool project! I'll rename. Thanks for the heads up. Now to think of a name. |
@camspiers are you on matrix? It might be interesting to join forces/exchange info. |
@mrcjkb Renamed. Thanks for the heads up. I've sent you a message on matrix. Feel free to reach out there on collaborating. |
@folke Sorry, to res this, but I also have a need for I'll give you my use case if it helps. Upon starting up nvim, I want to check if the |
More of a workaround than a solution, but what I currently do in |
Not every luarock can just be upstreamed to neovim |
Luarocks support is coming. See #1528 |
Did you check the docs?
Is your feature request related to a problem? Please describe.
I recently started making use of the Lua Rocks support that Packer has to be able to load JSON using the lua-cjson 'rock' and would like to be able to continue making use of it if possible.
Describe the solution you'd like
Support for a rocks table that we pass along side a plugin which acts like a dependency. That should then automatically download and install the lua rock so that it can be used by the plugin and it's config function.
Describe alternatives you've considered
No decent alternative solution that I am aware of short of manually installing luarocks and figuring out how to have Neovim load the rocks from a path which is not ideal considering that I have multiple other people using my config and I also use my config on multiple computers.
Additional context
No response
The text was updated successfully, but these errors were encountered: