Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildNeovimPlugin: pass a derivation to luaAttr #343564

Merged
merged 3 commits into from
Sep 22, 2024
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
10 changes: 6 additions & 4 deletions pkgs/applications/editors/neovim/build-neovim-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ in
# function to create vim plugin from lua packages that are already packaged in
# luaPackages
{
# the lua attribute name that matches this vim plugin. Both should be equal
# in the majority of cases but we make it possible to have different attribute names
luaAttr ? (normalizeName attrs.pname)
# the lua derivation to convert into a neovim plugin
luaAttr ? (lua.pkgs.${normalizeName attrs.pname})
, ...
}@attrs:
let
originalLuaDrv = lua.pkgs.${luaAttr};
originalLuaDrv = if (lib.typeOf luaAttr == "string") then
lib.warn "luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)" lua.pkgs.${normalizeName luaAttr}
else luaAttr;


luaDrv = originalLuaDrv.overrideAttrs (oa: {
version = attrs.version or oa.version;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/vim/plugins/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO check that no license information gets lost
{ callPackage, config, lib, vimUtils, vim, darwin, llvmPackages
, neovim-unwrapped
, neovimUtils
, luaPackages
}:

let
Expand All @@ -27,7 +27,7 @@ let
overrides = callPackage ./overrides.nix {
inherit (darwin.apple_sdk.frameworks) Cocoa CoreFoundation CoreServices;
inherit buildVimPlugin;
inherit llvmPackages luaPackages;
inherit llvmPackages;
};

aliases = if config.allowAliases then (import ./aliases.nix lib) else final: prev: {};
Expand Down
27 changes: 15 additions & 12 deletions pkgs/applications/editors/vim/plugins/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
, languagetool
, llvmPackages
, meson
, neovim-unwrapped
, nim1
, nodePackages
, openscad
Expand Down Expand Up @@ -129,10 +130,12 @@
, # hurl dependencies
hurl
, # must be lua51Packages
luaPackages
, luajitPackages
luajitPackages
,
}: self: super:
let
luaPackages = neovim-unwrapped.lua.pkgs;
in
{
alpha-nvim = super.alpha-nvim.overrideAttrs {
dependencies = [
Expand Down Expand Up @@ -915,7 +918,7 @@
dependencies = with self; [ nvim-treesitter ];
};

haskell-tools-nvim = neovimUtils.buildNeovimPlugin { luaAttr = "haskell-tools-nvim"; };
haskell-tools-nvim = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.haskell-tools-nvim; };

hex-nvim = super.hex-nvim.overrideAttrs {
postPatch = ''
Expand Down Expand Up @@ -1058,19 +1061,19 @@
};

lsp-progress-nvim = neovimUtils.buildNeovimPlugin {
luaAttr = "lsp-progress-nvim";
luaAttr = luaPackages.lsp-progress-nvim;
nvimRequireCheck = "lsp-progress";
};

luasnip = super.luasnip.overrideAttrs {
dependencies = with self; [ luaPackages.jsregexp ];
};

lz-n = neovimUtils.buildNeovimPlugin { luaAttr = "lz-n"; };
lz-n = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.lz-n; };

lze = neovimUtils.buildNeovimPlugin { luaAttr = "lze"; };
lze = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.lze; };

lzn-auto-require = neovimUtils.buildNeovimPlugin { luaAttr = "lzn-auto-require"; };
lzn-auto-require = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.lzn-auto-require; };

magma-nvim-goose = buildVimPlugin {
pname = "magma-nvim-goose";
Expand Down Expand Up @@ -1146,7 +1149,7 @@
};

middleclass = neovimUtils.buildNeovimPlugin {
luaAttr = "middleclass";
luaAttr = luaPackages.middleclass;
nvimRequireCheck = "middleclass";
};

Expand Down Expand Up @@ -1506,17 +1509,17 @@
];
};

rocks-nvim = neovimUtils.buildNeovimPlugin { luaAttr = "rocks-nvim"; };
rocks-nvim = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.rocks-nvim; };

rocks-config-nvim = neovimUtils.buildNeovimPlugin { luaAttr = "rocks-config-nvim"; };
rocks-config-nvim = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.rocks-config-nvim; };

roslyn-nvim = super.roslyn-nvim.overrideAttrs {
dependencies = with self; [ nvim-lspconfig ];
};

rtp-nvim = neovimUtils.buildNeovimPlugin { luaAttr = "rtp-nvim"; };
rtp-nvim = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.rtp-nvim; };

rustaceanvim = neovimUtils.buildNeovimPlugin { luaAttr = "rustaceanvim"; };
rustaceanvim = neovimUtils.buildNeovimPlugin { luaAttr = luaPackages.rustaceanvim; };

sg-nvim = super.sg-nvim.overrideAttrs (old:
let
Expand Down
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38519,9 +38519,7 @@ with pkgs;

vimUtils = callPackage ../applications/editors/vim/plugins/vim-utils.nix { };

vimPlugins = recurseIntoAttrs (callPackage ../applications/editors/vim/plugins {
luaPackages = lua51Packages;
});
vimPlugins = recurseIntoAttrs (callPackage ../applications/editors/vim/plugins { });

vimb-unwrapped = callPackage ../applications/networking/browsers/vimb { };
vimb = wrapFirefox vimb-unwrapped { };
Expand Down