feat: add support for share directories

This commit is contained in:
Marc Jakobi 2024-02-22 23:27:40 +01:00
parent 6c5c893f0d
commit c102a8311e
2 changed files with 14 additions and 8 deletions

View file

@ -11,8 +11,9 @@ which takes an attrset with the following arguments:
- `nvim`: The neovim package. Defaults to `neovim-unwrapped`.
- `neodev-types`: neodev.nvim types to add to the `workspace.library`.
Defaults to `"stable"`.
- Plugins: List of Neovim plugins and/or luarocks packages.
- `plugins`: List of Neovim plugins and/or luarocks packages.
Defaults to an empty list.
- `lua-version`: Defaults to `"5.1"`.
Example:

View file

@ -19,16 +19,19 @@
nvim ? final.neovim-unwrapped,
neodev-types ? "stable",
plugins ? [],
lua-version ? "5.1",
}: let
lib = final.lib;
plugin-lib-dirs = lib.lists.map (plugin:
if
partitions = builtins.partition (plugin:
builtins.hasAttr "vimPlugin" plugin
&& plugin.vimPlugin
|| plugin.pname == "nvim-treesitter"
then "${plugin}/lua"
else "${plugin}/lib/lua/5.1")
plugins;
|| plugin.pname == "nvim-treesitter")
plugins;
plugins = partitions.right;
rocks = partitions.wrong;
plugin-luadirs = builtins.map (plugin: "${plugin}/lua") plugins;
pkg-libdirs = builtins.map (pkg: "${pkg}/lib/lua/${lua-version}") rocks;
pkg-sharedirs = builtins.map (pkg: "${pkg}/share/lua/${lua-version}") rocks;
in {
runtime.version = "LuaJIT";
Lua = {
@ -43,7 +46,9 @@
"\${3rd}/busted/library"
"\${3rd}/luassert/library"
]
++ plugin-lib-dirs;
++ plugin-luadirs
++ pkg-libdirs
++ pkg-sharedirs;
ignoreDir = [
".git"
".github"