vhyrro / luarocks.nvim

Easily install luarocks with lazy.nvim
The Unlicense
64 stars 5 forks source link

Use system `luarocks` by default #21

Closed cryptomilk closed 2 months ago

cryptomilk commented 3 months ago

Looking at the instructions you suggest dnf install compat-lua-devel. Shouldn't it suggest to do: dnf install luarocks and use that instead? I really don't see why it should download and compile luarocks if I can install it with the package manager and use that one. You could make it configurable if you want to compile it, but the default should always be the distro system package.

vhyrro commented 2 months ago

Hey,

The reason why we do the compilation is that just because you have luarocks installed does not mean you have it installed in the correct way.

Luarocks must be compiled with a specific version of Lua. By default, most distros compile luarocks with Lua 5.4, which messes with things when you try to install Lua 5.1 packages. There are cases where luarocks doesn't even see the lua 5.1 packages when you try to install them, despite providing a --lua-version flag.

Therefore it's the best call for us to completely control the process from start to finish. We install luarocks to a single location that is controlled by Neovim. Luarocks is not a large program and is completely isolated, thus we don't consider it to be that big of a deal :)

cryptomilk commented 2 months ago

Looking at the package at fedora, there is no need to compile anything. It is a noarch package including just lua files. The only thing missing is a config file for 5.1. That could be added easily.

luarocks --lua-version 5.1
Configuration:
   Lua:
      Version    : 5.1
      Interpreter: /usr/bin/lua-5.1 (ok)
      LUA_DIR    : /usr (ok)
      LUA_BINDIR : /usr/bin (ok)
      LUA_INCDIR : /usr/include/lua-5.1 (ok)
      LUA_LIBDIR : /usr/lib64 (ok)

   Configuration files:
      System  : /etc/luarocks/config-5.1.lua (ok)
      User    : /root/.luarocks/config-5.1.lua (not found)

   Rocks trees in use:
      /root/.luarocks ("user")
      /usr ("system")

On Linux we are living in the Open Source world. Working around problems is normally not what we do, we fix them as we have access to the source code. The right thing to do would be to open bug reports on the distributions to get this fixed.

Downloading random code from the internet is normally not a good idea. You never know if there is a security process to update it in case there are security bugs. Didn't we just see that with the XZ backdoor? You normally want to have things managed by your distribution as they have security processes in place.

https://src.fedoraproject.org/rpms/luarocks/pull-request/6

cryptomilk commented 2 months ago

I've fixed it in Fedora: https://src.fedoraproject.org/rpms/luarocks/pull-request/6 openSUSE already has support for 5.1 and it is working.