mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-14 11:14:36 +02:00
modules/performance: add ability to byte compile lua plugins
This commit adds `performance.byteCompileLua.plugins` toggle that, if enabled, byte compiles all lua files in plugins
This commit is contained in:
parent
44849233e0
commit
55ca9d235b
3 changed files with 92 additions and 2 deletions
|
@ -87,8 +87,27 @@ in
|
|||
defaultPlugin // (if p ? plugin then p else { plugin = p; });
|
||||
normalizePluginList = plugins: map normalize plugins;
|
||||
|
||||
# Normalized plugin list
|
||||
normalizedPlugins = normalizePluginList config.extraPlugins;
|
||||
# Byte compiling of normalized plugin list
|
||||
byteCompilePlugins =
|
||||
plugins:
|
||||
let
|
||||
byteCompile =
|
||||
p:
|
||||
(helpers.byteCompileLuaDrv p).overrideAttrs (
|
||||
prev: lib.optionalAttrs (prev ? dependencies) { dependencies = map byteCompile prev.dependencies; }
|
||||
);
|
||||
in
|
||||
map (p: p // { plugin = byteCompile p.plugin; }) plugins;
|
||||
|
||||
# Normalized and optionally byte compiled plugin list
|
||||
normalizedPlugins =
|
||||
let
|
||||
normalized = normalizePluginList config.extraPlugins;
|
||||
in
|
||||
if config.performance.byteCompileLua.enable && config.performance.byteCompileLua.plugins then
|
||||
byteCompilePlugins normalized
|
||||
else
|
||||
normalized;
|
||||
|
||||
# Plugin list extended with dependencies
|
||||
allPlugins =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue