How to tell the difference between wrapped and unwrapped package?

Hello! I am trying to install neovim, and I see two packages in nox:

4 neovim-0.4.3 (nixos.neovim)
    Vim text editor fork focused on extensibility and agility
7 neovim-unwrapped-0.4.3 (nixos.neovim-unwrapped)
    Vim text editor fork focused on extensibility and agility

How do I learn the difference between the two? I took a very quick look at the sources of the packages, and, without going into details, they both look as “some nix code to package something”. Should I just read the source thoroughly? Or is there some secret manual which explains the high-level difference?

3 Likes

neovim-unwrapped is the derivation, whereas neovim is a wrapper around this derivation that adds some extra overriding capabilities to it. In my NixOS config I have for example

let
  myNeoVim = pkgs.neovim.override {
    vimAlias = true;
    configure = {
      plug.plugins = with pkgs.vimPlugins; [
        vim-nix
        vim-sensible
      ];
    };
  };
in
{
  environment.systemPackages = with pkgs; [
    ...
    myNeoVim
  ];
}

You can already see that the attributes that are passed to override are special to neovim and that is what the wrapper does for you. See also Neovim - NixOS Wiki

5 Likes

Ah, this is helpful! I guess I’ve got confused as to what “wrapper” means.

I though, wrongly, that wrapper would be a runtime-wrapper around neovim binary, which somehow makes it play better with NixOS or something.

Now I understand (please correct me that I am wrong) that wrapper is an evaluation-time wrapper around the base derivation, which allows one to pass extra arguments for additional configuration.

Yes and no. The wrapper is there to customize the configuration at evaluation time, but it will in fact provide a runtime wrapper around neovim. If you look at the source of the wrapper, you’ll see that it actually constructs a wrapper around the executable. However, unless you override the settings for neovim’s language bindings, this wrapper is a no-op. This is necessary, because when you install plugins neovim needs to be told where to look for them in the nix store.

3 Likes

I have started a document on the wiki to explain the naming conventions. It’s a stub with minimal information, but it would nice if you could check it out to see if my understanding of wrapped vs unwrapped is correct.

Maybe even extend it :slight_smile:

https://nixos.wiki/wiki/Package_naming_conventions

6 Likes

From my understanding(correct me if I’m wrong), Wrapped package is the default package that the software you are trying to install is shipped with. It is generally stable, receives only official updates ( which are less frequent updates). In short, it is the package that you get directly from the software provider.
On the other hand, unwrapped packages are built with the nixos compatibility/customization in mind i.e they are geared toward nioxos environment. They may contain patches, modifications etc that are specific to the distribution (i.e nixos). They receive frequent updates compared to the wrapped ones.
But the base functionality of the software and their locations and stuff like that are the same for both types of packages. So, there’s not much difference between the two in terms of usage. Hope this helps.