diff --git a/pkgs/applications/editors/vim/plugins/aliases.nix b/pkgs/applications/editors/vim/plugins/aliases.nix index 660fb8db03c10..936fc38925dc1 100644 --- a/pkgs/applications/editors/vim/plugins/aliases.nix +++ b/pkgs/applications/editors/vim/plugins/aliases.nix @@ -125,6 +125,7 @@ mapAliases ( surround = vim-surround; sleuth = vim-sleuth; solidity = vim-solidity; + ssr = ssr-nvim; # Added 2025-08-31 stylish-haskell = vim-stylish-haskell; stylishHaskell = vim-stylish-haskell; # backwards compat, added 2014-10-18 suda-vim = vim-suda; # backwards compat, added 2024-05-16 diff --git a/pkgs/applications/editors/vim/plugins/corePlugins.nix b/pkgs/applications/editors/vim/plugins/corePlugins.nix new file mode 100644 index 0000000000000..dde152b0837e8 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/corePlugins.nix @@ -0,0 +1,31 @@ +{ + symlinkJoin, +}: +final: prev: { + + corePlugins = symlinkJoin { + name = "core-vim-plugins"; + paths = with final; [ + # plugin managers + lazy-nvim + mini-deps + packer-nvim + vim-plug + + # core dependencies + plenary-nvim + + # popular plugins + mini-nvim + nvim-cmp + nvim-lspconfig + nvim-treesitter + vim-airline + vim-fugitive + vim-surround + ]; + + meta.description = "Collection of popular vim plugins (for internal testing purposes)"; + }; + +} diff --git a/pkgs/applications/editors/vim/plugins/default.nix b/pkgs/applications/editors/vim/plugins/default.nix index 0bf9f74f2edea..4937bb38f670b 100644 --- a/pkgs/applications/editors/vim/plugins/default.nix +++ b/pkgs/applications/editors/vim/plugins/default.nix @@ -48,6 +48,8 @@ let inherit (neovimUtils) buildNeovimPlugin; }; + corePlugins = callPackage ./corePlugins.nix { }; + # TL;DR # * Add your plugin to ./vim-plugin-names # * run ./update.py @@ -66,6 +68,7 @@ lib.pipe initialPackages [ (extends luaPackagePlugins) (extends nodePackagePlugins) (extends nonGeneratedPlugins) + (extends corePlugins) (extends overrides) (extends aliases) lib.makeExtensible diff --git a/pkgs/applications/editors/vim/plugins/luaPackagePlugins.nix b/pkgs/applications/editors/vim/plugins/luaPackagePlugins.nix index 8a94cc10b390a..851feed0f3e42 100644 --- a/pkgs/applications/editors/vim/plugins/luaPackagePlugins.nix +++ b/pkgs/applications/editors/vim/plugins/luaPackagePlugins.nix @@ -9,8 +9,10 @@ let luarocksPackageNames = [ "fidget-nvim" + "fzf-lua" "gitsigns-nvim" "grug-far-nvim" + "haskell-tools-nvim" "image-nvim" "lsp-progress-nvim" "lualine-nvim" @@ -34,6 +36,8 @@ let "plenary-nvim" "rest-nvim" "rocks-config-nvim" + "rocks-nvim" + "rustaceanvim" "rtp-nvim" "telescope-manix" "telescope-nvim" diff --git a/pkgs/applications/editors/vim/plugins/non-generated/notmuch-vim/default.nix b/pkgs/applications/editors/vim/plugins/non-generated/notmuch-vim/default.nix new file mode 100644 index 0000000000000..c9b44d89fa47e --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/non-generated/notmuch-vim/default.nix @@ -0,0 +1 @@ +{ notmuch }: notmuch.vim diff --git a/pkgs/applications/editors/vim/plugins/non-generated/nvim-treesitter-parsers/default.nix b/pkgs/applications/editors/vim/plugins/non-generated/nvim-treesitter-parsers/default.nix new file mode 100644 index 0000000000000..a1e9b0bc587d2 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/non-generated/nvim-treesitter-parsers/default.nix @@ -0,0 +1,5 @@ +{ + lib, + vimPlugins, +}: +lib.recurseIntoAttrs vimPlugins.nvim-treesitter.grammarPlugins diff --git a/pkgs/applications/editors/vim/plugins/non-generated/parinfer-rust/default.nix b/pkgs/applications/editors/vim/plugins/non-generated/parinfer-rust/default.nix new file mode 100644 index 0000000000000..bb36ee7776410 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/non-generated/parinfer-rust/default.nix @@ -0,0 +1 @@ +{ parinfer-rust }: parinfer-rust diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 6baecc1ec162b..a6b3d06c14684 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -7,9 +7,7 @@ fetchFromGitHub, fetchpatch, fetchurl, - neovimUtils, replaceVars, - symlinkJoin, # Language dependencies fetchYarnDeps, mkYarnModules, @@ -35,10 +33,8 @@ neovim-unwrapped, nim1, nodejs, - notmuch, openscad, openssh, - parinfer-rust, ranger, ripgrep, sqlite, @@ -64,7 +60,6 @@ codeium, # command-t dependencies getconf, - ruby, # cornelis dependencies cornelis, # cpsm dependencies @@ -108,7 +103,6 @@ # hurl dependencies hurl, # must be lua51Packages - luajitPackages, aider-chat, # typst-preview dependencies tinymist, @@ -131,42 +125,22 @@ self: super: let luaPackages = neovim-unwrapped.lua.pkgs; - # Ensure the vim plugin builders are not used in this file. - # If they are used, these stubs will throw. - buildVimPlugin = throw "New plugin definitions should be done outside `overrides.nix`"; - buildNeoVimPlugin = throw "New plugin definitions should be done outside `overrides.nix`"; + # Ensures new attributes are not added in this file. + assertNoAdditions = + overrides: + let + prevNames = lib.attrNames super; + definedNames = lib.attrNames overrides; + addedNames = lib.subtractLists prevNames definedNames; + in + lib.throwIfNot (addedNames == [ ]) + "vimPlugins: the following attributes should not be defined in overrides.nix:${ + lib.concatMapStrings (name: "\n- ${name}") addedNames + }" + overrides; in -{ - corePlugins = symlinkJoin { - name = "core-vim-plugins"; - paths = with self; [ - # plugin managers - lazy-nvim - mini-deps - packer-nvim - vim-plug - - # core dependencies - plenary-nvim - - # popular plugins - mini-nvim - nvim-cmp - nvim-lspconfig - nvim-treesitter - vim-airline - vim-fugitive - vim-surround - ]; - - meta = { - description = "Collection of popular vim plugins (for internal testing purposes)"; - }; - }; - - ####################### - # Regular overrides +assertNoAdditions { advanced-git-search-nvim = super.advanced-git-search-nvim.overrideAttrs { checkInputs = with self; [ snacks-nvim @@ -1306,8 +1280,7 @@ in dependencies = [ self.plenary-nvim ]; }; - fzf-lua = neovimUtils.buildNeovimPlugin { - luaAttr = luaPackages.fzf-lua; + fzf-lua = super.fzf-lua.overrideAttrs { runtimeDeps = [ fzf ]; nvimSkipModules = [ "fzf-lua.shell_helper" @@ -1433,10 +1406,9 @@ in dependencies = [ self.luasnip ]; }; - haskell-tools-nvim = neovimUtils.buildNeovimPlugin { + haskell-tools-nvim = super.haskell-tools-nvim.overrideAttrs { # Optional integrations checkInputs = [ self.telescope-nvim ]; - luaAttr = luaPackages.haskell-tools-nvim; }; helm-ls-nvim = super.helm-ls-nvim.overrideAttrs { @@ -2339,8 +2311,6 @@ in NotebookNavigator-nvim = super.NotebookNavigator-nvim.overrideAttrs { }; - notmuch-vim = notmuch.vim; - nterm-nvim = super.nterm-nvim.overrideAttrs { dependencies = [ self.aniseed ]; }; @@ -2699,8 +2669,6 @@ in dependencies = [ self.nvim-treesitter ]; }; - nvim-treesitter-parsers = lib.recurseIntoAttrs self.nvim-treesitter.grammarPlugins; - nvim-treesitter-pyfold = super.nvim-treesitter-pyfold.overrideAttrs { dependencies = [ self.nvim-treesitter ]; }; @@ -2905,8 +2873,6 @@ in dependencies = [ self.nui-nvim ]; }; - inherit parinfer-rust; - parpar-nvim = super.parpar-nvim.overrideAttrs { dependencies = with self; [ nvim-parinfer @@ -3091,27 +3057,22 @@ in dependencies = [ self.plenary-nvim ]; }; - rocks-nvim = - (neovimUtils.buildNeovimPlugin { - luaAttr = luaPackages.rocks-nvim; - }).overrideAttrs - (oa: { - passthru = oa.passthru // { - initLua = '' - vim.g.rocks_nvim = { - luarocks_binary = "${neovim-unwrapped.lua.pkgs.luarocks_bootstrap}/bin/luarocks" - } - ''; - }; + rocks-nvim = super.rocks-nvim.overrideAttrs (oa: { + passthru = oa.passthru // { + initLua = '' + vim.g.rocks_nvim = { + luarocks_binary = "${neovim-unwrapped.lua.pkgs.luarocks_bootstrap}/bin/luarocks" + } + ''; + }; - }); + }); - rustaceanvim = neovimUtils.buildNeovimPlugin { + rustaceanvim = super.rustaceanvim.overrideAttrs { checkInputs = [ # Optional integration self.neotest ]; - luaAttr = luaPackages.rustaceanvim; }; rust-tools-nvim = super.rust-tools-nvim.overrideAttrs { @@ -3252,7 +3213,7 @@ in } ); - ssr = super.ssr-nvim.overrideAttrs { + ssr-nvim = super.ssr-nvim.overrideAttrs { dependencies = [ self.nvim-treesitter ]; };