vhyrro / luarocks.nvim

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

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

Closed TheLeoP closed 3 months ago

TheLeoP commented 6 months ago

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).

https://github.com/vhyrro/luarocks.nvim/blob/0809b0eca132bcb380a284b6a004702868f93617/lua/luarocks-nvim/rocks.lua#L25

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).

nadvorniktom commented 6 months ago

I'm also having this issue.

vhyrro commented 5 months ago

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.

TheLeoP commented 5 months ago

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.
hambergerpls commented 3 months ago

@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.