aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/installers/context.lua4
-rw-r--r--lua/nvim-lsp-installer/platform.lua10
-rw-r--r--lua/nvim-lsp-installer/servers/rust_analyzer/init.lua12
3 files changed, 22 insertions, 4 deletions
diff --git a/lua/nvim-lsp-installer/installers/context.lua b/lua/nvim-lsp-installer/installers/context.lua
index 7f3761d6..3dda0ab2 100644
--- a/lua/nvim-lsp-installer/installers/context.lua
+++ b/lua/nvim-lsp-installer/installers/context.lua
@@ -84,8 +84,8 @@ function M.use_github_release_file(repo, file, opts)
)
context.stdio_sink.stderr(
(
- "Could not find which release file to download. Most likely, the current operating system or architecture (%s) is not supported.\n"
- ):format(platform.arch)
+ "Could not find which release file to download. Most likely the current operating system, architecture (%s), or libc (%s) is not supported.\n"
+ ):format(platform.arch, platform.get_libc())
)
return nil
end
diff --git a/lua/nvim-lsp-installer/platform.lua b/lua/nvim-lsp-installer/platform.lua
index 9ab54c6a..62c74046 100644
--- a/lua/nvim-lsp-installer/platform.lua
+++ b/lua/nvim-lsp-installer/platform.lua
@@ -25,6 +25,16 @@ M.is_unix = vim.fn.has "unix" == 1
M.is_mac = vim.fn.has "mac" == 1
M.is_linux = not M.is_mac and M.is_unix
+-- @return string @The libc found on the system, musl or glibc (glibc if ldd is not found)
+function M.get_libc()
+ local _, _, libc_exit_code = os.execute "ldd --version 2>&1 | grep -q musl"
+ if libc_exit_code == 0 then
+ return "musl"
+ else
+ return "glibc"
+ end
+end
+
-- PATH separator
M.path_sep = M.is_win and ";" or ":"
diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
index b2c8f7b8..5651cc7f 100644
--- a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
+++ b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
@@ -7,6 +7,8 @@ local Data = require "nvim-lsp-installer.data"
local coalesce, when = Data.coalesce, Data.when
+local libc = platform.get_libc()
+
local target = coalesce(
when(
platform.is_mac,
@@ -18,8 +20,14 @@ local target = coalesce(
when(
platform.is_linux,
coalesce(
- when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"),
- when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz")
+ when(
+ libc == "glibc",
+ coalesce(
+ when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"),
+ when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz")
+ )
+ ),
+ when(libc == "musl", coalesce(when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-musl.gz")))
)
),
when(