Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions pkgs/applications/editors/vim/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ let
inherit (neovimUtils) buildNeovimPlugin;
};

extras = callPackage ./extras.nix {
inherit buildVimPlugin;
inherit (neovimUtils) buildNeovimPlugin;
};

# TL;DR
# * Add your plugin to ./vim-plugin-names
# * run ./update.py
Expand All @@ -36,9 +41,11 @@ let
};

aliases = if config.allowAliases then (import ./aliases.nix lib) else final: prev: { };

extensible-self = lib.makeExtensible (
extends aliases (extends overrides (extends plugins initialPackages))
);
in
extensible-self
lib.pipe initialPackages [
(extends plugins)
(extends extras)
(extends overrides)
(extends aliases)
lib.makeExtensible
]
104 changes: 104 additions & 0 deletions pkgs/applications/editors/vim/plugins/extras.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
lib,
buildVimPlugin,
buildNeovimPlugin,
nodePackages,
neovim-unwrapped,
}:
let
luaPackages = neovim-unwrapped.lua.pkgs;
in
self: super:
(
let
nodePackageNames = [
"coc-cmake"
"coc-docker"
"coc-emmet"
"coc-eslint"
"coc-explorer"
"coc-flutter"
"coc-git"
"coc-go"
"coc-haxe"
"coc-highlight"
"coc-html"
"coc-java"
"coc-jest"
"coc-json"
"coc-lists"
"coc-ltex"
"coc-markdownlint"
"coc-pairs"
"coc-prettier"
"coc-r-lsp"
"coc-rls"
"coc-rust-analyzer"
"coc-sh"
"coc-smartf"
"coc-snippets"
"coc-solargraph"
"coc-spell-checker"
"coc-sqlfluff"
"coc-stylelint"
"coc-sumneko-lua"
"coc-tabnine"
"coc-texlab"
"coc-tsserver"
"coc-ultisnips"
"coc-vetur"
"coc-vimlsp"
"coc-vimtex"
"coc-wxml"
"coc-yaml"
"coc-yank"
];
nodePackage2VimPackage =
name:
buildVimPlugin {
pname = name;
inherit (nodePackages.${name}) version meta;
src = "${nodePackages.${name}}/lib/node_modules/${name}";
};
in
lib.genAttrs nodePackageNames nodePackage2VimPackage
)
// (
let
luarocksPackageNames = [
"fidget-nvim"
"gitsigns-nvim"
"image-nvim"
"lsp-progress-nvim"
"lualine-nvim"
"luasnip"
"lush-nvim"
"lz-n"
"lze"
"lzextras"
"lzn-auto-require"
"middleclass"
"mini-test"
"neorg"
"neotest"
"nui-nvim"
"nvim-cmp"
"nvim-nio"
"nvim-web-devicons"
"oil-nvim"
"orgmode"
"papis-nvim"
"rest-nvim"
"rocks-config-nvim"
"rtp-nvim"
"telescope-manix"
"telescope-nvim"
];
toVimPackage =
name:
buildNeovimPlugin {
luaAttr = luaPackages.${name};
};
in
lib.genAttrs luarocksPackageNames toVimPackage
)
101 changes: 6 additions & 95 deletions pkgs/applications/editors/vim/plugins/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ in
dependencies = [ self.plenary-nvim ];
};

# NOTE: this overrides a luaPackages-based plugin
gitsigns-nvim = super.gitsigns-nvim.overrideAttrs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main driver for using buildNeovimPlugin is to not have to add dependencies. Could this have been deleted instead ? same remark for the rest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nixvim's update has been blocked for a while because these overrides were no longer being applied (they we're being silently shadowed by the luaPackages-based plugins). So at least currently, most of them are still needed.

I agree, ideally buildNeovimPlugin and/or toVimPackage would correctly propagate the underlying lua package's dependencies, however it seems like that isn't currently happening.

It's also possible that the dependencies are being propagated, but there is an issue in nixvim's combine-plugins impl. IIRC we only saw errors when combine-pluigins was being used.

Either way, overrides shouldn't be silently ignored, and this PR fixes that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also possible that the dependencies are being propagated, but there is an issue in nixvim's combine-plugins impl

Looking at nixvim's impl, that may be the case. It looks like we explicitly flat-map plugins and their dependencies but don't consider things like propagatedBuildInputs.

https://github.com/nix-community/nixvim/blob/33097dcf776d1fad0ff3842096c4e3546312f251/modules/top-level/output.nix#L209-L215

dependencies = [ self.plenary-nvim ];
};
Expand Down Expand Up @@ -1421,6 +1422,7 @@ in
doInstallCheck = true;
};

# NOTE: this overrides a luaPackages-based plugin
image-nvim = super.image-nvim.overrideAttrs {
dependencies = with self; [
nvim-treesitter
Expand Down Expand Up @@ -1683,6 +1685,7 @@ in
dependencies = [ self.lualine-nvim ];
};

# NOTE: this overrides a luaPackages-based plugin
luasnip = super.luasnip.overrideAttrs {
dependencies = [ luaPackages.jsregexp ];
};
Expand Down Expand Up @@ -1949,6 +1952,7 @@ in
];
};

# NOTE: this overrides a luaPackages-based plugin
neotest = super.neotest.overrideAttrs {
dependencies = with self; [
nvim-nio
Expand Down Expand Up @@ -2838,6 +2842,7 @@ in
};

# needs "http" and "json" treesitter grammars too
# NOTE: this overrides a luaPackages-based plugin
rest-nvim = super.rest-nvim.overrideAttrs {
dependencies = with self; [
plenary-nvim
Expand Down Expand Up @@ -3225,6 +3230,7 @@ in
dependencies = [ self.plenary-nvim ];
};

# NOTE: this overrides a luaPackages-based plugin
telescope-nvim = super.telescope-nvim.overrideAttrs {
dependencies = [ self.plenary-nvim ];
};
Expand Down Expand Up @@ -3988,101 +3994,6 @@ in
'';

};
}
// (
let
nodePackageNames = [
"coc-cmake"
"coc-docker"
"coc-emmet"
"coc-eslint"
"coc-explorer"
"coc-flutter"
"coc-git"
"coc-go"
"coc-haxe"
"coc-highlight"
"coc-html"
"coc-java"
"coc-jest"
"coc-json"
"coc-lists"
"coc-ltex"
"coc-markdownlint"
"coc-pairs"
"coc-prettier"
"coc-r-lsp"
"coc-rls"
"coc-rust-analyzer"
"coc-sh"
"coc-smartf"
"coc-snippets"
"coc-solargraph"
"coc-spell-checker"
"coc-sqlfluff"
"coc-stylelint"
"coc-sumneko-lua"
"coc-tabnine"
"coc-texlab"
"coc-tsserver"
"coc-ultisnips"
"coc-vetur"
"coc-vimlsp"
"coc-vimtex"
"coc-wxml"
"coc-yaml"
"coc-yank"
];
nodePackage2VimPackage =
name:
buildVimPlugin {
pname = name;
inherit (nodePackages.${name}) version meta;
src = "${nodePackages.${name}}/lib/node_modules/${name}";
};
in
lib.genAttrs nodePackageNames nodePackage2VimPackage
)
// (
let
luarocksPackageNames = [
"fidget-nvim"
"gitsigns-nvim"
"image-nvim"
"lsp-progress-nvim"
"lualine-nvim"
"luasnip"
"lush-nvim"
"lz-n"
"lze"
"lzextras"
"lzn-auto-require"
"middleclass"
"mini-test"
"neorg"
"neotest"
"nui-nvim"
"nvim-cmp"
"nvim-nio"
"nvim-web-devicons"
"oil-nvim"
"orgmode"
"papis-nvim"
"rest-nvim"
"rocks-config-nvim"
"rtp-nvim"
"telescope-manix"
"telescope-nvim"
];
toVimPackage =
name:
neovimUtils.buildNeovimPlugin {
luaAttr = luaPackages.${name};
};
in
lib.genAttrs luarocksPackageNames toVimPackage
)
// {

rocks-nvim =
(neovimUtils.buildNeovimPlugin {
Expand Down