dotfiles/modules/programs/nvim/default.nix

93 lines
2.1 KiB
Nix

{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.vim;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
in
{
options.my.programs.vim = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
extraLuaConfig = builtins.readFile ./init.lua;
extraPackages = with pkgs; [
black
isort
nil
nixpkgs-fmt
rustfmt
shfmt
stylua
sumneko-lua-language-server
taplo
yamlfmt
];
plugins = with pkgs.vimPlugins; [
catppuccin-nvim
cmp-nvim-lsp
cmp_luasnip
comment-nvim
copilot-cmp
copilot-lua
dashboard-nvim
formatter-nvim
gitsigns-nvim
lsp_lines-nvim
lspkind-nvim
lualine-lsp-progress
lualine-nvim
luasnip
neogit
noice-nvim
nui-nvim # for noice-nvim
nvim-autopairs
nvim-cmp
nvim-lastplace
nvim-lspconfig
nvim-surround
nvim-tree-lua
nvim-treesitter-textsubjects
nvim-treesitter.withAllGrammars
nvim-ts-context-commentstring
nvim-web-devicons # for dashboard-nvim
orgmode
plenary-nvim # for telescope, neogit
telescope-nvim
vim-lion
which-key-nvim
];
};
};
}