system/home/progs/nvim/default.nix

82 lines
2 KiB
Nix
Raw Normal View History

2022-06-23 10:45:58 +03:00
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.progs.nvim;
customPlugins = pkgs.callPackage ./custom_plugins.nix {
inherit (pkgs.vimUtils) buildVimPlugin;
};
plugins = pkgs.vimPlugins // customPlugins;
myVimPlugins = with plugins; [
2022-08-29 15:40:41 +03:00
coc-tsserver # typescript LSP
coc-eslint # eslint LSP
coc-rust-analyzer # rust LSP
2022-06-23 10:45:58 +03:00
2022-08-29 15:40:41 +03:00
editorconfig-vim # use project .editorconfig to configure editor
lightline-vim # configurable status line
material-vim # modern theme with true colors support
vim-nix # nix support
vim-easymotion # highlights keys to move quickly
vim-gitgutter # shows git diff markers in the sign column
nerdtree # tree explorer
nerdtree-git-plugin # shows files git status on the NerdTree
neoformat # formating code
nvim-treesitter # treesitter configurations and abstraction layer
fzf-vim # fuzzy finder
blamer-nvim # A git blame plugin
2022-06-23 10:45:58 +03:00
];
# Additional language servers that we should install mannually
2022-06-23 23:04:59 +03:00
lspPackages = with pkgs; [ rnix-lsp ];
# Additional tools
2022-08-29 15:40:41 +03:00
fzfToolsPackages = with pkgs; [ fzf ripgrep ];
additionalPackages = lspPackages ++ fzfToolsPackages;
2022-06-23 10:45:58 +03:00
vimConfig = builtins.readFile ./config.vim;
cocConfig = import ./coc_settings.nix;
2022-06-23 10:45:58 +03:00
in
{
options.progs.nvim = {
enable = mkOption {
type = types.bool;
default = false;
2022-06-23 23:04:59 +03:00
description = "Add and configure neovim";
2022-06-23 10:45:58 +03:00
};
default = mkOption {
type = types.bool;
default = false;
description = "Set neovim as default editor";
};
};
2022-08-29 15:40:41 +03:00
2022-06-23 10:45:58 +03:00
config = mkIf cfg.enable {
2022-06-23 23:04:59 +03:00
home.packages = additionalPackages;
2022-08-29 15:40:41 +03:00
2022-06-23 10:45:58 +03:00
programs.neovim = {
enable = true;
extraConfig = vimConfig;
plugins = myVimPlugins;
viAlias = true;
vimAlias = true;
coc = {
enable = true;
settings = cocConfig;
};
2022-06-23 10:45:58 +03:00
};
xdg.configFile = {
"nvim/lua".source = ./lua;
2022-06-23 10:45:58 +03:00
};
2022-06-23 23:04:59 +03:00
home.sessionVariables = mkIf cfg.default {
2022-08-29 14:11:17 +03:00
EDITOR = "nvim";
2022-06-23 23:04:59 +03:00
};
2022-06-23 10:45:58 +03:00
};
}