I’m trying to install Lua on my netlify site and just thought I’d see if it’s something you might add to the build image in the future? Lua is small, self contained and stable, so I assume it would not be complicated to add.
It’s also very versatile, and can be used as a glue language for C code, and as a scripting language. It’s also used as a built in programming language in many other tools such as pandoc. There is a huge wikipedia list of the many ways it’s used. So it should be useful to other developers too.
The version I use, and pandoc uses, is 5.3, this seems to be more common than the more recent 5.4, which isn’t backwardly compatible.
Having it available would certainly make my life easier without impacting your image maintenance, and I’m sure I can’t be the only one.
FYI pandoc comes with lua built in and is already installed on your image - I’m not sure if that means lua is already available somehow, I’m looking into that.
Hi, @s6mike. You should be able to install Lua by adding file named Brewfile.netlify to the base directory of the repo with the following text inside it:
brew "lua"
That will install Lua using Homebrew during the dependency install stage of the deploy.
There is more information about this on the page here (towards the bottom of the page):
OMG thanks for that…I’ve been trying brew install, install, with quotes, without quotes, nothing was working, and the error messages were not helpful - so then I tried --debug flags etc.
Always so simple when you know how. Thanks for replying so quick and ending my confusion!
I’m installing lua 5.3 (which is what I build my package in) and I’m also installing luarocks:
brew "lua@5.3"
brew "luarocks"
However, luarocks by default installs 5.4 not 5.3, which might explain why I’m getting this error:
But I’m getting this error:
lua: ./lua_modules/share/lua/5.3/pl/path.lua:26: pl.path requires LuaFileSystem
12:54:31 AM: stack traceback:
12:54:31 AM: [C]: in function "error"
12:54:31 AM: ./lua_modules/share/lua/5.3/pl/path.lua:26: in main chunk
12:54:31 AM: [C]: in function "require"
12:54:31 AM: ./lua_modules/share/lua/5.3/pl/app.lua:9: in main chunk
12:54:31 AM: [C]: in function "require"
12:54:31 AM: ./lua_modules/share/lua/5.3/pl/import_into.lua:67: in metamethod "index"
12:54:31 AM: src/lua/argmap2mup.lua:593: in upvalue "parse_options"
12:54:31 AM: src/lua/argmap2mup.lua:630: in local "main"
12:54:31 AM: src/lua/argmap2mup.lua:699: in main chunk
12:54:31 AM: [C]: in ?
It’s possible that luarocks is looking in the 5.4 path rather than 5.3, although I’ve checked the cpath and run a search in my script to confirm the location of the installed LuaFileSystem lfs.so file, which is in /opt/buildhome/.luarocks/lib/lua/5.3/lfs.so which is covered by this CPATH: /opt/buildhome/.luarocks/lib/lua/5.3/lfs.so
When running my package’s rockspec file I’ve used the following command to install it in 5.3 location: luarocks --lua-dir="$(brew --prefix)/opt/lua@5.3" --lua-version=5.3 make "$rockspec_file"
And the deployment log says it’s being installed for both 5.3 (due to my customisation) and 5.4 (the default):
2:28:40 AM: Rocks installed for Lua 5.4
2:28:40 AM: ---------------------------
2:28:41 AM: Rocks installed for Lua 5.3
2:28:41 AM: ---------------------------
Wondering if I can stop LuaRocks being installed for 5.4, in case that’s causing the issue. Any idea how to do that in the brewfile?
I’ve called luarocks init to ensure the config is all lua 5.3.
Now i realise the problem is that lua is calling lua 5.4 not lua 5.3 - so now I’ve fixed the above it isn’t finding any luarocks installs at all! Rather than just lfs.
Though I would welcome more documentation on how brew is configured on netlify and what Alpha status means for this feature (given that I’m not a beta tester of your service let alone an alpha tester!)
@s6mike Our Product team holds the keys to that kingdom, and they’re the ones making those decisions so we can’t really speak to when or if features will be developed or move from Alpha to Beta. But fear not, if you have other questions or if there’s anything else you’re curious about, let us know!
brewfile install of lua@5.3 takes 45s, which is a significant chunk of the build time for my site. The other 2 brew installs (rockfiles and libyaml) are much faster.
I tried using netlify-plugin-cache" to cache “.cache/” which is used by brewfile, and lua@5.3 is installed there but this hasn’t sped it up.