-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
vimPlugins: use lua derivation if it exists #178180
Conversation
echo "Sourcing luarocks-move-data-hook.sh" | ||
|
||
luarocksMoveDataHook () { | ||
echo "Executing luarocksMoveDataHook" | ||
if [ -d "$out/$rocksSubdir" ]; then | ||
cp -rfv "$out/$rocksSubdir/$pname/$version/." "$out" | ||
fi | ||
|
||
echo "Finished executing luarocksMoveDataHook" | ||
} | ||
|
||
echo "Using luarocksMoveDataHook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that a bit much noise for just copying some files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is one of the tricky part so I wanted it to stand out:
- there is no way to tell luarocks to install "data" in the root folder
- it is easy to plug in only for vim plugins and makes it clear it only concerns these plugins
passthru = (oldAttrs.passthru or {}) // { | ||
vimPlugin = true; | ||
}; | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry I dont get the issue here
inherit (callPackage ./build-neovim-plugin.nix { | ||
inherit (vimUtils) buildVimPluginFrom2Nix toVimPlugin; | ||
inherit buildLuarocksPackage; | ||
}) buildNeovimPluginFrom2Nix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while it's not a problem here this is generally not a great pattern. the x
in inherit (x) ys ...
is evaluated indepdently for every y
, so adding something here would evaluate the whole thing many times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha I had no idea thanks, I've removed the outer "inherit".
Neovim plugins are now more often than not written in lua. One advantage of the lua ecosystem over vim's is the existence of luarocks and the rockspec format, which allows to specify a package dependencies formally. I would like more neovim plugins to have a formal description, "rockspec" being the current candidate. This MR allows to use nix lua packages as neovim plugins, so as to enjoy every benefit that rockspecs bring: - dependdency discovery - ability to run test suite - luarocks versioning - rockspec metadata the vim update.py script will check if an attribute with the vim plugin pname exists in lua51Packages. If it does, it uses buildNeovimPluginFrom2Nix on it, which modifies the luarocks config to do an almost flat install (luarocks will install the package in the lua folder instead of share/5.1/lua etc). It also calls toVimPlugin on it to get all the vim plugin niceties. The list of packages that could benefit from this is available at https://luarocks.org/labels/neovim but I hope it grows.
Co-authored-by: pennae <82953136+pennae@users.noreply.github.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
a2b1220
to
eff864d
Compare
This reverts commit d7bfa0d, which causes build issues since NixOS#178180 was merged.
I think this causes a number of problems. For one, I think by default, we just want vim plugins to mirror latest github as that's what other vim package managers do. |
These are valid concerns, overriding the specified src silently as done right now is bad.
Nix can do better though. We can use the rockspec from the repo instead of the one from luarocks so it's not necessarily the issue. I will coordinate with tjdevries to update the rockspec on the server as a quickfix. |
I think this would be better done once the luarocks ecosystem is a bit more mature and there is a critical mass of people actually using it to manage their nvim plugins outside of nix. Project authors themselves will also have to keep the rockspec up-to-date. I just feel it's too much too early.
It's from at least Dec 2020 so it was already there when the rockspec was added but maybe the spec is missing something for it? |
so I've opened #183304 to track the status of the telescope resolution. As for the rockspec-based packages, you gotta start somewhere. There has been no complaint so far so I think it's overall ok with the issue that you have mentioned that can be improved. I've opened #185397 to track it. There is an effort to have neovim plugin format https://github.com/nvim-lua/nvim-package-specification |
The plugin is being built using `luaPackages` since NixOS#178180.
`toVimPlugin` function mentioned is added with NixOS#178180.
The plugin is being built using `luaPackages` since #178180.
`toVimPlugin` function mentioned is added with #178180.
Shouldn't this use luajit instead of lua 5.1? |
Neovim plugins are now more often than not written in lua.
One advantage of the lua ecosystem over vim's is the existence of
luarocks and the rockspec format, which allows to specify a package
dependencies formally.
I would like more neovim plugins to have a formal description,
"rockspec" being the current candidate.
This MR allows to use nix lua packages as neovim plugins, so as to enjoy
every benefit that rockspecs bring:
the vim update.py script will check if an attribute with the vim plugin
pname exists in lua51Packages. If it does, it uses
buildNeovimPluginFrom2Nix on it, which modifies the luarocks config to
do an almost flat install (luarocks will install the package in the lua
folder instead of share/5.1/lua etc).
It also calls toVimPlugin on it to get all the vim plugin niceties.
The list of packages that could benefit from this is available at
https://luarocks.org/labels/neovim
but I hope it grows.
Description of changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes