How can I add tools to neovim (using override)

I want to have self-contained neovim with tools, (using git as an example).

Try to append to the *buildInputs attributes but doesn’t seem to work

  neovim_plus = super.neovim.overrideAttrs (oldAttrs: {
    nativeBuildInputs = [
      super.git
    ];

    buildInputs = oldAttrs.buildInputs ++ [
      super.git
    ];

    propagatedBuildInputs = [
      super.git
    ];
  });

I want to use it via nix-shell like this

$ nix-shell --pure -p neovim_plus --run git
/tmp/nix-shell-13717-0/rc: line 1: git: command not found

If this is the wrong approach and I should create new derivation instead, please show me how.
The wrapper doesn’t have any argument to pass external tool to neovim.

I want to be able to get the neovim_plus anywhere using nix-shell.

The idea is to make variations based on language and tools, (instead of creating shell.nix for everyone of each and have to point to file path when running nix-shell)

Sounds to me like you want to use something like

neovim_plus = super.buildEnv {
  name = "neovim_plus";
  paths = [
    super.neovim
    super.git
  ]
}

This will build a single package that links in everything from neovim and git. You can see examples in §2.6.1 Build an environment.

1 Like

in the home-manager module you can also add extraPackages that will be put in neovim’s PATH.