feat(nvim): add golang lsp

This commit is contained in:
matt1432 2025-04-21 02:02:23 -04:00
parent 83bc927a8d
commit 4d6a733a6e
4 changed files with 45 additions and 0 deletions
configurations/android
homeManagerModules/neovim

View file

@ -52,6 +52,7 @@
user = "nix-on-droid";
ideConfig = {
enableGolang = false;
enableJava = false;
enableNix = false;
enablePython = false;

View file

@ -25,6 +25,10 @@ in {
type = types.bool;
default = true;
};
enableGolang = mkOption {
type = types.bool;
default = true;
};
enableJava = mkOption {
type = types.bool;
default = true;

View file

@ -14,6 +14,7 @@ in {
imports = [
./bash
./c-lang
./golang
./hyprlang
./java
./json

View file

@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf (cfg.enable && cfg.ideConfig.enableGolang) {
programs = {
neovim = {
extraPackages = with pkgs; [go gopls];
plugins = [
{
plugin = pkgs.vimPlugins.clangd_extensions-nvim;
type = "lua";
config =
# lua
''
local lsp = require('lspconfig');
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
lsp.gopls.setup({
cmd = { '${pkgs.gopls}/bin/gopls' },
capabilities = default_capabilities,
});
'';
}
];
};
};
};
# For accurate stack trace
_file = ./default.nix;
}