Hi Guix!

I've had a PR up on Codeberg for a few months about adding Lua search
paths, but it hasn't had much attention. I guess Lua stuff kind of falls
through the cracks of the different teams.

https://codeberg.org/guix/guix/pulls/2796

I'm sending this email to try to find someone to review it. 🙂

Currently, Lua search paths are broken in Guix. There was an issue
opened for this in 2017[1], and another in 2021[2], but I haven't seen
any movement since then.

The primary issue is that LUA_PATH and LUA_CPATH are not like search
paths that Guix constructs. Instead, the entries are considered as
"patterns" by Lua, with a "?" indicating where it should insert the name
of the library it's trying to load. This means that we can't use Guix's
search path mechanism to construct these LUA_* variables. In our current
Lua packages we work around this with wrappers which set LUA_*
appropriately, but that doesn't work for shells/profiles.

My solution to this is to patch the Lua source to honour two new
environment variables: GUIX_LUA_PATH and GUIX_LUA_CPATH. These are
search paths which Guix can construct, and our patched Lua on startup
rewrites them into the form that Lua expects. I have patched all the
versions of Lua I could find in Guix (5.4, 5.3, 5.2, 5.1, and luajit). I
have also changed everything I could find that was setting/wrapping
LUA_* to use the new GUIX_LUA_* variables where possible.

If anyone is about to review my PR, I would appreciate it. It would be
nice for Lua to be able to find its libraries.

https://codeberg.org/guix/guix/pulls/2796

Carlo

[1]: https://issues.guix.gnu.org/issue/25425
[2]: https://issues.guix.gnu.org/issue/44662

Reply via email to