Adding Registries #1369
-
Preface : I am new to the vim, linux ecosystem, so apologies for the ignorance on my part. tl;dr : Please provide a sample for adding 'lua' registry type (and 'github' type for that matter. I was unable to add my fork). Additionally, consider 'json' registry type ? I've added my own lua registry, using a single package from the mason-registry as a test. I took and converted a package entry from the .json from the releases page, converted to a lua table, then add it as the only entry in the returned registry (a list of packages). I source it using absolute path to the "registry.lua". Mason recognizes it, but fails to install the test package I included. Source : return {
{
name = "lua-language-server",
description = "A language server that offers Lua language support - programmed in Lua.",
homepage = "https://github.com/LuaLS/lua-language-server",
licenses = {
"MIT"
},
languages = {
"Lua"
},
categories = {
"LSP"
},
source = {
id = "pkg:github/LuaLS/lua-language-server@3.6.22",
asset = {
{
target = "darwin_arm64",
file = "lua-language-server-{{version}}-darwin-arm64.tar.gz:libexec/",
bin = "exec:libexec/bin/lua-language-server"
},
{
target = "darwin_x64",
file = "lua-language-server-{{version}}-darwin-x64.tar.gz:libexec/",
bin = "exec:libexec/bin/lua-language-server"
},
{
target = "linux_arm64_gnu",
file = "lua-language-server-{{version}}-linux-arm64.tar.gz:libexec/",
bin = "exec:libexec/bin/lua-language-server"
},
{
target = "linux_x64_gnu",
file = "lua-language-server-{{version}}-linux-x64.tar.gz:libexec/",
bin = "exec:libexec/bin/lua-language-server"
},
{
target = "linux_x64_musl",
file = "lua-language-server-{{version}}-linux-x64-musl.tar.gz:libexec/",
bin = "exec:libexec/bin/lua-language-server"
},
{
target = "win_x86",
file = "lua-language-server-{{version}}-win32-ia32.zip",
bin = "bin/lua-language-server.exe"
},
{
target = "win_x64",
file = "lua-language-server-{{version}}-win32-x64.zip",
bin = "bin/lua-language-server.exe"
}
}
},
schemas = {
lsp = "vscode:https://raw.githubusercontent.com/LuaLS/vscode-lua/master/package.json"
},
bin = {
["lua-language-server"] = "{{source.asset.bin}}"
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello! Custom registries is half-supported in the sense that while the settings allows you to register custom registries, many of the APIs involved in making a registry is not really made stable & public yet, hence no docs for custom registries yet. Mason currently supports two types of registry sources,
-- ~/.config/nvim/lua/custom-registry/init.lua
return {
["lua-linter"] = "custom-registry.packages.lua-linter",
["rust-linter"] = "custom-registry.packages.rust-linter",
}
In the example below I'll be using the -- ~/.config/nvim/lua/custom-registry/packages/lua-linter.lua
local Pkg = require "mason-core.package"
return Pkg.new {
name = "lua-linter",
desc = "Lua Linter.",
homepage = "https://lua-linter.org",
categories = { Pkg.Cat.Linter },
languages = { Pkg.Lang.Lua },
install = function (ctx)
-- ctx: https://github.com/williamboman/mason.nvim/blob/main/doc/reference.md#installcontext
ctx.spawn.luarocks { "install", "lua-linter" }
ctx.fs:write_file("some-file", "some file contents idk")
-- …
ctx.receipt:with_primary_source {
type = "unmanaged"
}
end
}
require("mason").setup {
registries = {
"lua:custom-registry", -- "custom-registry" here is what you'd pass to require() the index module (see 1) above)
"github:mason-org/mason-registry",
}
} |
Beta Was this translation helpful? Give feedback.
Hello! Custom registries is half-supported in the sense that while the settings allows you to register custom registries, many of the APIs involved in making a registry is not really made stable & public yet, hence no docs for custom registries yet.
Mason currently supports two types of registry sources,
github
andlua
.github
is the newer one and is used for https://github.com/mason-org/mason-registry. Creating a customgithub
registry is currently a bit tedious as there are no tools for this, you'll essentially have to manually recreate the setup in place at https://github.com/mason-org/mason-registry. I plan to make this easier in the form of reusable GitHub actions and a repo template…