vhyrro/luarocks.nvim

[windows] [feature request] expose additional args to pass to luarocks install command

TheLeoP opened this issue · 4 comments

Some rocks, like lua-curl, need a binary installation. This is not a problem on Unix like system because of how they handle libraries. On windows, most of the time a user would need to pass a custom path for the location of the headers needed for said binary installations.

In the case of lua-curl, the variable LUA_CURLDIR needs to be defined (for example, in my case, I installed the headers files needed on C:\Users\pcx\Desktop\vcpkg\installed\x64-windows). The option to pass aditional arguments to the luarocks install command would solve this issue (LUA_CURLDIR=C:\Users\pcx\Desktop\vcpkg\installed\x64-windows on my example).

local output = vim.fn.system({ paths.luarocks, "install", "--deps-only", paths.rockspec })

I could create a PR handling this if the feature is deemed desirable and an interface for plugins/end users is agreed upon (or I could propose one).

I'm also having this issue.

Sounds sensible! Theoretically you could do this by modifying vim.env in lazy's init function, but having it as part of the setup process could make it more discoverable.

I may be wrong, but, as far as I understand, the values passed to luarocks install can't be passed via environment variables. They do override the variables of the luarocks config though (I'm not sure if users are expected to modify it directly or to use some interface exposed by this plugin).

The following comes from luarocks --help:

Variables:
   Variables from the "variables" table of the configuration file can be
   overridden with VAR=VALUE assignments.

@TheLeoP

I had a similar problem when adding lua-curl to my rocks list when using NixOS. It couldn't compile because it couldn't find the path to libcurl /includes and /lib. The only solution is to pass CURL_DIR variable to luarocks install as suggested from the error I got and it didn't work when I set CURL_DIR in my environment variables.

Turns out the variable is not pulled from the environment variables, but instead passed as a command argument like you have pointed out.

So I have created a PR #32 that allows passing install variables and I managed to get lua-curl to be installed.