vhyrro / luarocks.nvim

Easily install luarocks with lazy.nvim
The Unlicense
83 stars 6 forks source link

[Request]: Attempt to use the Neovim Lua interpreter by default. #2

Closed vhyrro closed 7 months ago

vhyrro commented 8 months ago

Instead of looking for a global Lua installation on the user's system, perhaps it would be possible to use Neovim builtin Lua interpreter as the driver for Luarocks itself.

Not even sure if this is possible, but it doesn't sound that difficult either. Perhaps with some trickery it could be done.

TheLeoP commented 7 months ago

It looks like it's indeed possible (with a simple workaround script to transform the arguments in the format expected by lua to the format expected by nvim -l)

vhyrro commented 7 months ago

@TheLeoP yeah, it seems like we can easily get 50% of the way there with nlua. I've tried this before though and it's not all sunshine and rainbows.

It seems that the configure script doesn't like us passing nlua as the lua binary. Additionally, luarocks needs API headers for Lua itself, something that nlua nor Neovim expose :(

It is likely still possible with some workarounds, but getting it all to work isn't the easiest in the world :smile:

vhyrro commented 7 months ago

All I can think of is vendoring our own lua.h headers (doesn't sound all that great, but might fix the issue).

Or, we compile luarocks with whatever lua version luarocks can find, and then after the compilation step we alter the configuration to use nlua.

I think the latter is the best approach, and should make the compilation process suceed the most.

vhyrro commented 7 months ago

This doesn't seem to be possible, not with how things work in luarocks currently. I added the ability to compile with LuaJIT as a target in the meantime! Should make adoption much smoother for MacOS users :)