NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.64k stars 13.79k forks source link

Missing lua dependency of the LuaSnip nvim plugin #306367

Closed pierrot-lc closed 1 month ago

pierrot-lc commented 5 months ago

Describe the bug

I installed vimPlugins.luasnip. When running :checkhealth, luasnip says that the dependency jsregexp is not found.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install neovim with the plugin vimPlugins.luasnip
  2. Run :checkhealth command

For example, using home-manager:

{
  programs.neovim = {
    enable = true;
    plugins = [ pkgs.vimPlugins.luasnip ];
  };
}

Expected behavior

When installing the plugin, the lua package of the plugin is used instead (see here). That luasnip package should come with jsregexp as described in its nix expression.

Screenshots

Screenshot from 2024-04-23 21-51-56

Additional context

I noticed that the lua jsregexp package is indeed built by nix, along with the lua luasnip package. So the error may come from the package not being added to the neovim lua runtime path.

The error disappear when adding jsregexp in extraLuaPackages like so:

{
  programs.neovim = {
    enable = true;
    plugins = [ pkgs.vimPlugins.luasnip ];
    extraLuaPackages = ps: [ ps.jsregexp ];
  };
}

I managed to reproduce the error using kickstart-nvim.nix and nixvim as well.

Notify maintainers

@teto @GaetanLepage @mrcjkb

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.7, NixOS, 24.05 (Uakari), 24.05.20240419.5c24cf2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/v4pcs3nzx54m5bmxd39win0rgl2d2hbx-source`

Add a :+1: reaction to issues you find important.

teto commented 5 months ago

Indeed I know about the issue. I have it working locally and I am upstreaming the fixes hopefully before 24.05. I will keep you informed.

julienTraversier commented 5 months ago

With nixvim the workarround doesn't seems to work.

GaetanLepage commented 5 months ago

Should be fixed by #309762

GaetanLepage commented 4 months ago

The PR has been merged. @pierrot-lc feel free to test :)

pierrot-lc commented 4 months ago

The PR has been merged. @pierrot-lc feel free to test :)

Sadly it does not seem to be fixed. The warning is still raised. I think the issue is related to the way luasnip is installed by nix. The dependency jsregexp seems to be used here but it is still not found in the lua environment of nvim. I do not fully understand the way lua packages are built, so maybe there's something that I miss somewhere.

mrcjkb commented 4 months ago

We might need to wait for @teto's fix to get into master and/or unstable.

pierrot-lc commented 1 month ago

Hi all, just a quick comment to say that now LuaSnip is shipped with jsregexp (thanks!). If I understand correctly, it works for this plugin because it is declared as a luarocks lib and is wrapped around it.

Do you think we should do the same thing for other common vim plugins (such as Neorg, which has a lot of dependencies as well)? I saw the development of rocks.nvim and I wonder if we should automatically detect the dependencies declared by plugins that way?

mrcjkb commented 1 month ago

Do you think we should do the same thing for other common vim plugins (such as Neorg, which has a lot of dependencies as well)? I saw the development of rocks.nvim and I wonder if we should automatically detect the dependencies declared by plugins that way?

that's what we're working on 😄

pierrot-lc commented 1 month ago

that's what we're working on 😄

Amazing 😄 , thanks all of you for your hard work. I'm closing this since the original issue is fixed!