mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/performance: add ability to byte-compile plugin lua dependencies
This commit adds byte compiling of plugin lua dependencies (specifically propagatedBuildInputs). It's enabled by `performance.byteCompileLua.luaLib` option.
This commit is contained in:
parent
404e56066f
commit
2c6182351f
4 changed files with 108 additions and 1 deletions
28
modules/top-level/plugins/byte-compile-lua-lib.nix
Normal file
28
modules/top-level/plugins/byte-compile-lua-lib.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Byte compiling of lua dependencies of normalized plugin list
|
||||
|
||||
Inputs: List of normalized plugins
|
||||
Outputs: List of normalized plugins with all the propagatedBuildInputs byte-compiled
|
||||
*/
|
||||
{ lib, pkgs }:
|
||||
let
|
||||
builders = lib.nixvim.builders.withPkgs pkgs;
|
||||
inherit (import ./utils.nix lib) mapNormalizedPlugins;
|
||||
|
||||
# Byte-compile only lua dependencies
|
||||
byteCompileDeps =
|
||||
drv:
|
||||
drv.overrideAttrs (
|
||||
prev:
|
||||
lib.optionalAttrs (prev ? propagatedBuildInputs) {
|
||||
propagatedBuildInputs = map byteCompile prev.propagatedBuildInputs;
|
||||
}
|
||||
);
|
||||
# Byte-compile derivation (but only if it's a lua module) and its dependencies
|
||||
byteCompile =
|
||||
drv:
|
||||
byteCompileDeps (
|
||||
if pkgs.luaPackages.luaLib.hasLuaModule drv then builders.byteCompileLuaDrv drv else drv
|
||||
);
|
||||
in
|
||||
mapNormalizedPlugins byteCompileDeps
|
Loading…
Add table
Add a link
Reference in a new issue