nixos-configs/common/home/neovim/default.nix

212 lines
5.4 KiB
Nix
Raw Normal View History

2023-11-07 08:05:07 -05:00
{ pkgs, lib, neovim-flake, ... }: let
2023-07-19 21:52:35 -04:00
# installs a vim plugin from git with a given tag / branch
plugin = owner: repo: rev: hash: pkgs.vimUtils.buildVimPlugin {
2023-07-19 21:52:35 -04:00
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
src = pkgs.fetchFromGitHub {
inherit rev owner repo hash;
2023-07-19 21:52:35 -04:00
};
};
fileContents = lib.strings.fileContents;
in {
# TODO: make a gradle module and have java in device-vars.nix
xdg.dataFile = {
".gradle/gradle.properties".source =
pkgs.writeText "gradle.properties" ''
org.gradle.java.home = ${pkgs.temurin-bin-17}
'';
2023-09-19 23:23:19 -04:00
};
2023-10-22 15:35:25 -04:00
home.packages = with pkgs; [
gradle
gradle-completion # FIXME: not working
];
programs = {
java = {
enable = true;
package = pkgs.temurin-bin-17;
};
neovim = {
enable = true;
# Temp fix https://github.com/nix-community/neovim-nightly-overlay/issues/332
package = neovim-flake.packages.x86_64-linux.default.override {
2023-11-07 08:05:07 -05:00
libvterm-neovim = pkgs.libvterm-neovim.overrideAttrs (prev: final: {
doCheck = false;
version = "0.3.3";
src = pkgs.fetchurl {
url = "https://launchpad.net/libvterm/trunk/v0.3.3/+download/libvterm-0.3.3.tar.gz";
hash = "sha256-CRVvQ90hKL00fL7r5Q2aVx0yxk4M8Y0hEZeUav9yJuA=";
};
});
};
withNodeJs = true;
withPython3 = true;
withRuby = false;
2023-10-26 00:35:24 -04:00
defaultEditor = true;
viAlias = true;
vimAlias = true;
extraPackages = with pkgs; [
nodejs_latest
2023-10-26 00:35:24 -04:00
nodePackages.npm
nodePackages.neovim
gradle
2023-10-26 00:35:24 -04:00
bat
nil
];
2023-10-26 00:35:24 -04:00
extraPython3Packages = with pkgs.python311Packages; [
pylint
];
coc = {
enable = true;
settings = {
# General
"colors.enable" = true;
"coc.preferences.formatOnType" = true;
"diagnostic.checkCurrentLine" = true;
2023-10-26 00:35:24 -04:00
"inlayHint.enable" = false;
# Eslint
2023-10-20 17:46:00 -04:00
"eslint.format.enable" = true;
"eslint.autoFixOnSave" = true;
# Stylelint
"stylelintplus.enable" = true;
"stylelintplus.cssInJs" = true;
"stylelintplus.autoFixOnSave" = true;
"stylelintplus.autoFixOnFormat" = true;
"css.validate" = false;
"less.validate" = false;
"scss.validate" = false;
"wxss.validate" = false;
# Lua lsp
"Lua.misc.parameters" = [
"--metapath"
"~/.cache/sumneko_lua/meta"
"--logpath"
"~/.cache/sumneko_lua/log"
];
"Lua.workspace.library" = [
"$\{3rd\}/luv/library"
];
sumneko-lua = {
serverDir = "${pkgs.lua-language-server}/share/lua-language-server";
enableNvimLuaDev = true;
};
# Nix
languageserver = {
nix = {
command = "nil";
filetypes = [ "nix" ];
rootPatterns = [ "flake.nix" ];
};
};
# Misc
"java.jdt.ls.java.home" = "${pkgs.temurin-bin-17}";
"bashIde.shellcheckPath" = "${pkgs.shellcheck}/bin/shellcheck";
};
};
extraConfig = fileContents ./base.vim;
plugins = with pkgs.vimPlugins; [
# Coc configured
coc-css
coc-eslint
coc-java
coc-sh
coc-stylelintplus
{
plugin = coc-snippets;
type = "viml";
config = fileContents ./plugins/snippets.vim;
}
## Lua
coc-sumneko-lua
neodev-nvim
## Fzf
coc-fzf
fzfWrapper
fzf-vim
coc-highlight
coc-json
coc-pyright
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
fugitive
{
plugin = dracula-nvim;
type = "viml";
config = fileContents ./plugins/dracula.vim;
}
{
plugin = lualine-nvim;
type = "lua";
config = fileContents ./plugins/lualine.lua;
}
{
plugin = todo-comments-nvim;
type = "lua";
config = "require('todo-comments').setup()";
}
{
plugin = gitsigns-nvim;
type = "lua";
2023-10-30 20:24:47 -04:00
config = fileContents ./plugins/gitsigns.lua;
}
{
plugin = nvim-autopairs;
type = "lua";
config = fileContents ./plugins/autopairs.lua;
}
2023-10-27 16:24:45 -04:00
nvim-treesitter-context
nvim-treesitter-textobjects
{
plugin = nvim-treesitter.withAllGrammars;
type = "viml";
config = fileContents ./plugins/treesitter.vim;
}
{
plugin = (plugin "lukas-reineke" "indent-blankline.nvim"
"046e2cf04e08ece927bacbfb87c5b35c0b636546"
"sha256-bhoep8aTYje5K/dZ/XmpwBPn4PBEMPrmw33QJdfFe6M=");
type = "lua";
config = fileContents ./plugins/indent.lua;
}
{
2023-10-27 16:24:45 -04:00
plugin = mini-nvim;
type = "lua";
2023-10-27 16:24:45 -04:00
config = fileContents ./plugins/mini.lua;
}
{
plugin = neo-tree-nvim;
type = "viml";
config = ''
${fileContents ./plugins/neotree.vim}
lua << EOF
${fileContents ./plugins/neotree.lua}
EOF
'';
}
];
};
2023-07-19 21:52:35 -04:00
};
}