feat: byte-compile plugins

This commit is contained in:
diniamo 2024-08-05 14:57:02 +02:00
parent 13cc59ab99
commit 5c79c458fc

View file

@ -36,8 +36,16 @@ inputs: {
src = getAttr ("plugin-" + pname) inputs; src = getAttr ("plugin-" + pname) inputs;
in in
pkgs.stdenvNoCC.mkDerivation ({ pkgs.stdenvNoCC.mkDerivation ({
inherit src;
version = src.shortRev or src.shortDirtyRev or "dirty"; version = src.shortRev or src.shortDirtyRev or "dirty";
inherit src;
buildPhase = lib.optionalString vimOptions.byteCompileLua ''
runHook preBuild
find . -type f -name '*.lua' -exec luajit -bd -- {} {} \;
runHook postBuild
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -49,15 +57,6 @@ inputs: {
} }
// attrs); // attrs);
noBuildPlug = {pname, ...} @ attrs: let
input = getAttr ("plugin-" + pname) inputs;
in
{
version = input.shortRev or input.shortDirtyRev or "dirty";
outPath = getAttr ("plugin-" + pname) inputs;
}
// attrs;
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
buildConfigPlugins = plugins: buildConfigPlugins = plugins:
@ -77,7 +76,7 @@ inputs: {
patches = [../patches/flutter-tools.patch]; patches = [../patches/flutter-tools.patch];
} }
) )
else noBuildPlug {pname = plug;} else buildPlug {pname = plug;}
) )
else plug else plug
)) ))