Skip to content

What about packspec (pkg.json)?

Marc Jakobi edited this page Jun 4, 2024 · 23 revisions

Some Neovim users / plugin authors campaign against luarocks adoption, because they believe it will be made redundant by packspec/pkg.json.

Tip

Don't worry, you can still find their plugins on luarocks, thanks to the NURR.

To address some of those concerns:

I see packspec (or whatever "wild west half-baked dependencies declaration format") as merely a high-leverage, low-effort way to start formally connecting the existing web of vim/nvim dependencies. It doesn't preclude a luarocks approach at all, it simply formalizes what already exists--assuming it gets any traction.

If Nvim plugins can successfully use luarocks then pkg.json is redundant. pkg.json is only useful for ecosystems that don’t have centralized package management.

  • Luarocks will likely never be bundled with Neovim.

    • Instead, we will soon be bundling it with rocks.nvim.
    • You will only need to bootstrap a temporary installation, which currently works well on most UNIX-like systems.
  • Packspec's main strength is:

LuaRocks is a "centralized" approach that requires active participation from many plugins. In contrast, pkg.json is a decentralized, "infectious" approach that is useful at the "leaf nodes": it only requires the consumer to provide a pkg.json, the upstream dependencies don't need to be "compliant" or participate in any way.

  • This is half-baked, and ends at transitive dependencies. For example, if

    • plugin X depends on library Y and library Y has any dependencies
    • library Y does not contain a pkg.json

    a packspec-compliant plugin manager will pull library A without its dependencies. There's a reason decentralized package management hasn't ever been a thing (save for nix flakes, which are experimental and have their own problems).

  • Concerns about an initial lack of luarocks adoption can be (and have been) addressed by the fact that package maintainers and plugin authors don't need to be the same people.

  • Luarocks has the ability to build and package plugins. With this, we can precompile binary rocks so you don't have to. This is out of scope for pkg.json and will require out-of-spec fields.

  • Luarocks is a full-fledged package manager that supports the coexistence of different versions of the same dependency.

  • Luarocks is the status quo for Lua packages outside of the Neovim ecosystem.

  • Packspec is in Alpha and incomplete.

Clone this wiki locally