feat: add luarc-to-json and mk-luarc helpers

This commit is contained in:
Marc Jakobi 2024-02-22 23:07:20 +01:00
parent b674635702
commit 6c5c893f0d

View file

@ -14,7 +14,7 @@
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
flake = { flake = {
overlays.default = final: prev: { overlays.default = final: prev: {
mk-luarc-json = { mk-luarc = {
# list of plugins that have a /lua directory # list of plugins that have a /lua directory
nvim ? final.neovim-unwrapped, nvim ? final.neovim-unwrapped,
neodev-types ? "stable", neodev-types ? "stable",
@ -29,38 +29,37 @@
then "${plugin}/lua" then "${plugin}/lua"
else "${plugin}/lib/lua/5.1") else "${plugin}/lib/lua/5.1")
plugins; plugins;
luarc = { in {
runtime.version = "LuaJIT"; runtime.version = "LuaJIT";
Lua = { Lua = {
globals = [ globals = [
"vim" "vim"
];
workspace = {
library =
[
"${nvim}/share/nvim/runtime/lua"
"${final.vimPlugins.neodev-nvim}/types/${neodev-types}"
"\${3rd}/busted/library"
"\${3rd}/luassert/library"
]
++ plugin-lib-dirs;
ignoreDir = [
".git"
".github"
".direnv"
"result"
"nix"
"doc"
]; ];
workspace = { };
library = diagnostics = {
[ libraryFiles = "Disable";
"${nvim}/share/nvim/runtime/lua" disable = [];
"${final.vimPlugins.neodev-nvim}/types/${neodev-types}"
"\${3rd}/busted/library"
"\${3rd}/luassert/library"
]
++ plugin-lib-dirs;
ignoreDir = [
".git"
".github"
".direnv"
"result"
"nix"
"doc"
];
};
diagnostics = {
libraryFiles = "Disable";
disable = [];
};
}; };
}; };
in };
final.runCommand ".luarc.json" { luarc-to-json = luarc: final.runCommand ".luarc.json" {
buildInputs = [ buildInputs = [
final.jq final.jq
]; ];
@ -71,6 +70,7 @@
jq . <"$rawJSONPath" jq . <"$rawJSONPath"
} >$out } >$out
''; '';
mk-luarc-json = attrs: final.luarc-to-json (final.mk-luarc attrs);
}; };
}; };
}; };