Skip to content

Commit 8325575

Browse files
av1155Uzaaft
andauthored
fix(lua): skip selene install on aarch64 platforms (#1464)
* fix(pack.lua): skip selene install on aarch64 platforms selene is not compatible with aarch64 (e.g., Raspberry Pi 5). This adds architecture detection to avoid installing selene where unsupported, while preserving all other functionality. This prevents startup errors and failed installs. * style(lua-pack): fix stylua formatting for CI compliance * Update README.md * refactor(nvim-lint): group selene config under single if block * Update init.lua * Update init.lua --------- Co-authored-by: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com>
1 parent 5b671aa commit 8325575

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

lua/astrocommunity/pack/lua/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ This plugin pack does the following:
66
- Adds `lua_ls` language server
77
- Adds `stylua` formatter
88
- Adds `selene` linter
9+
- On `aarch64` machines this is skipped.

lua/astrocommunity/pack/lua/init.lua

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,24 @@ local function selene_configured(path)
22
return #vim.fs.find("selene.toml", { path = path, upward = true, type = "file" }) > 0
33
end
44

5+
local is_aarch64 = vim.loop.os_uname().machine == "aarch64"
6+
57
return {
68
{
79
"AstroNvim/astrolsp",
810
optional = true,
911
opts = {
1012
config = {
11-
lua_ls = { settings = { Lua = { hint = { enable = true, arrayIndex = "Disable" } } } },
13+
lua_ls = {
14+
settings = {
15+
Lua = {
16+
hint = {
17+
enable = true,
18+
arrayIndex = "Disable",
19+
},
20+
},
21+
},
22+
},
1223
},
1324
},
1425
},
@@ -32,14 +43,21 @@ return {
3243
"jay-babu/mason-null-ls.nvim",
3344
optional = true,
3445
opts = function(_, opts)
35-
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "stylua", "selene" })
46+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
47+
"stylua",
48+
(not is_aarch64 and "selene") or nil,
49+
})
50+
3651
if not opts.handlers then opts.handlers = {} end
37-
opts.handlers.selene = function(source_name, methods)
38-
local null_ls = require "null-ls"
39-
for _, method in ipairs(methods) do
40-
null_ls.register(null_ls.builtins[method][source_name].with {
41-
runtime_condition = function(params) return selene_configured(params.bufname) end,
42-
})
52+
53+
if not is_aarch64 then
54+
opts.handlers.selene = function(source_name, methods)
55+
local null_ls = require "null-ls"
56+
for _, method in ipairs(methods) do
57+
null_ls.register(null_ls.builtins[method][source_name].with {
58+
runtime_condition = function(params) return selene_configured(params.bufname) end,
59+
})
60+
end
4361
end
4462
end
4563
end,
@@ -48,8 +66,11 @@ return {
4866
"WhoIsSethDaniel/mason-tool-installer.nvim",
4967
optional = true,
5068
opts = function(_, opts)
51-
opts.ensure_installed =
52-
require("astrocore").list_insert_unique(opts.ensure_installed, { "lua-language-server", "stylua", "selene" })
69+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
70+
"lua-language-server",
71+
"stylua",
72+
(not is_aarch64 and "selene") or nil,
73+
})
5374
end,
5475
},
5576
{
@@ -64,13 +85,16 @@ return {
6485
{
6586
"mfussenegger/nvim-lint",
6687
optional = true,
67-
opts = {
68-
linters_by_ft = {
69-
lua = { "selene" },
70-
},
71-
linters = {
72-
selene = { condition = function(ctx) return selene_configured(ctx.filename) end },
73-
},
74-
},
88+
opts = function(_, opts)
89+
if not is_aarch64 then
90+
opts.linters_by_ft = {
91+
lua = { "selene" },
92+
}
93+
opts.linters = opts.linters or {}
94+
opts.linters.selene = {
95+
condition = function(ctx) return selene_configured(ctx.filename) end,
96+
}
97+
end
98+
end,
7599
},
76100
}

0 commit comments

Comments
 (0)