feat(rocks): use hererocks to install luarocks when luarocks is not found

This commit is contained in:
Folke Lemaitre 2024-06-25 07:55:30 +02:00
parent dea1f687fe
commit d87da76679
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 58 additions and 2 deletions

View file

@ -112,6 +112,32 @@ local function _load()
Util.track()
end
---@return LazyPluginSpec?, string?
function M.hererocks()
if not (Config.options.rocks.enabled and Config.options.rocks.hererocks) then
return
end
local root = Config.options.rocks.root .. "/hererocks"
local cmd = {
"python",
"hererocks.py",
"--verbose",
"-l",
"5.1",
"-r",
"latest",
root,
}
return {
"luarocks/hererocks",
lazy = true,
build = table.concat(cmd, " "),
}, root
end
---@param dir string
---@return LazyPkg?
---@overload fun():LazyPkg[]