nixos-config/users/simon/modules/neovim/default.nix

136 lines
3.3 KiB
Nix

{ config, lib, nixosConfig, pkgs, ... }:
let
rainbow_csv = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
name = "rainbow_csv";
src = pkgs.fetchFromGitHub {
owner = "mechatroner";
repo = name;
rev = "df89266d6c03479def77793fd7a0a651986865a5";
sha256 = "0c9b1r49vw6r3yhm6g02janyxw6d9j6bkjmv8zpdav46avmk74fh";
};
meta.license = lib.licenses.mit;
};
vim-openscad = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
name = "vim-openscad";
src = pkgs.fetchFromGitHub {
owner = "sirtaj";
repo = name;
rev = "81db508b1888fdbea994d43ccef1acd86c8af3f7";
sha256 = "1wcdfayjpb9h0lzwdi5nda4c0ch263fdr0379l9k1gf47bgq9cx2";
};
meta.license = lib.licenses.publicDomain;
};
Vim-Jinja2-Syntax = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
name = "Vim-Jinja2-Syntax";
src = pkgs.fetchFromGitHub {
owner = "Glench";
repo = name;
rev = "5d2496eb5fd4415c7ce062ccbcd53a3f0de93aa3";
sha256 = "1ss065b2psalli46bs3v13fhaplqydh13bg3jg3zr98wbdn70cws";
};
meta.license = lib.licenses.bsd3;
};
in
{
programs.neovim = {
enable = true;
package = pkgs.neovim-unwrapped;
vimAlias = true;
extraConfig = ''
lua require('init')
'';
extraPackages = with pkgs; [
unzip # zip.vim
] ++ (lib.optionals nixosConfig.sbruder.full [
gopls
haskell-language-server
rnix-lsp
rust-analyzer
(python3.withPackages (ps: with ps; [
pyls-isort
pylsp-mypy
python-lsp-black
python-lsp-server
# pylsp optional dependencies
flake8
mccabe
pycodestyle
pydocstyle
pyflakes
pylint
]))
nodePackages."@tailwindcss/language-server"
universal-ctags
]);
plugins = with pkgs.vimPlugins; [
Vim-Jinja2-Syntax
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp_luasnip
diffview-nvim
editorconfig-nvim
friendly-snippets
gitsigns-nvim
lspkind-nvim
lualine-lsp-progress
lualine-nvim
luasnip
neogit
nvim-cmp
nvim-lspconfig
nvim-solarized-lua
nvim-treesitter
nvim-web-devicons
plenary-nvim
rainbow_csv
rust-vim
tagbar
telescope-nvim
telescope-ui-select-nvim
trouble-nvim
vim-fugitive
vim-illuminate
vim-markdown
vim-nix
vim-openscad
vim-snippets
vimtex
which-key-nvim
];
};
xdg.configFile = {
"nvim/lua/init.lua".source = ./init.lua;
"nvim/lua/snippets.lua".source = pkgs.callPackage ./snippets.nix { };
} // (lib.mapAttrs'
(name: path: lib.nameValuePair "nvim/parser/${lib.removePrefix "tree-sitter-" name}.so" { source = "${path}/parser"; })
({
inherit (pkgs.tree-sitter.builtGrammars)
tree-sitter-bash
tree-sitter-c
tree-sitter-cpp
tree-sitter-css
tree-sitter-dot
tree-sitter-go
tree-sitter-haskell
tree-sitter-html
tree-sitter-json
#tree-sitter-latex # incompatible with VimTeX
tree-sitter-lua
tree-sitter-nix
tree-sitter-perl
tree-sitter-python
tree-sitter-rust
tree-sitter-scss
tree-sitter-toml
tree-sitter-yaml;
}));
home.sessionVariables.EDITOR = "nvim";
}