add lua language server using overlays
This commit is contained in:
parent
49c5fb4a8d
commit
69c7fdda24
3 changed files with 80 additions and 0 deletions
5
home.nix
5
home.nix
|
@ -6,6 +6,10 @@
|
|||
|
||||
imports = (import ./programs);
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(import ./overlays/sumneko-lua-language-server)
|
||||
];
|
||||
|
||||
home = {
|
||||
username = "salar";
|
||||
homeDirectory = "/Users/salar";
|
||||
|
@ -211,6 +215,7 @@
|
|||
pkgs.ripgrep
|
||||
pkgs.rnix-lsp
|
||||
pkgs.shellcheck
|
||||
pkgs.sumneko-lua-language-server
|
||||
pkgs.tealdeer
|
||||
pkgs.tig
|
||||
pkgs.tokei
|
||||
|
|
38
overlays/sumneko-lua-language-server/default.nix
Normal file
38
overlays/sumneko-lua-language-server/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
self: super: {
|
||||
sumneko-lua-language-server = super.sumneko-lua-language-server.overrideAttrs (
|
||||
o: rec {
|
||||
version = "2.2.3";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "https://github.com/sumneko/vscode-lua/releases/download/v${version}/lua-${version}.vsix";
|
||||
sha256 = "16rpi6p7rslpdfi37ndy5g9qmvh22qljfk9w15kdrr668hfwp7nm";
|
||||
};
|
||||
|
||||
unpackPhase = ''
|
||||
${super.pkgs.unzip}/bin/unzip $src
|
||||
'';
|
||||
|
||||
platform = if super.stdenv.isDarwin then "macOS" else "Linux";
|
||||
|
||||
preBuild = "";
|
||||
postBuild = "";
|
||||
nativeBuildInputs = [
|
||||
super.makeWrapper
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r extension $out/extras
|
||||
chmod a+x $out/extras/server/bin/$platform/lua-language-server
|
||||
makeWrapper $out/extras/server/bin/$platform/lua-language-server \
|
||||
$out/bin/lua-language-server \
|
||||
--add-flags "-E -e LANG=en $out/extras/server/main.lua \
|
||||
--logpath='~/.cache/sumneko_lua/log' \
|
||||
--metapath='~/.cache/sumneko_lua/meta'"
|
||||
'';
|
||||
|
||||
meta.platforms = super.lib.platforms.all;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ _G.load_config = function()
|
|||
|
||||
require('nvim-autopairs').setup()
|
||||
require("which-key").setup()
|
||||
require('gitsigns').setup()
|
||||
require("salargalaxyline")
|
||||
|
||||
-- Treesitter
|
||||
|
@ -208,6 +209,42 @@ _G.load_config = function()
|
|||
nvim_lsp[lsp].setup { on_attach = on_attach }
|
||||
end
|
||||
|
||||
|
||||
-- lua language server
|
||||
local sumneko_binary = vim.fn.getenv("HOME").."/.nix-profile/bin/lua-language-server"
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, 'lua/?.lua')
|
||||
table.insert(runtime_path, 'lua/?/init.lua')
|
||||
|
||||
require('lspconfig').sumneko_lua.setup {
|
||||
cmd = { sumneko_binary },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- metals
|
||||
vim.opt_global.shortmess:remove("F"):append("c")
|
||||
metals_config = require("metals").bare_config
|
||||
|
|
Loading…
Reference in a new issue