Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/performance.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ in
luaLib = lib.mkEnableOption "luaLib" // {
description = "Whether to byte compile lua library.";
};
excludedPlugins = lib.mkOption {
type = with types; listOf (either str package);
default = [ ];
example = lib.literalExpression ''
[
"faster.nvim"
pkgs.vimPlugins.conform-nvim
];
'';
description = "List of plugins (names or packages) to exclude from byte compilation.";
};
};

combinePlugins = {
Expand Down
14 changes: 12 additions & 2 deletions modules/top-level/plugins/byte-compile-plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
Inputs: List of normalized plugins
Outputs: List of normalized (compiled) plugins
*/
{ lib, pkgs }:
{
lib,
pkgs,
excludedPlugins,
}:
normalizedPlugins:
let
builders = lib.nixvim.builders.withPkgs pkgs;
inherit (import ./utils.nix lib) mapNormalizedPlugins;

excludedNames = map (p: if builtins.isString p then p else lib.getName p) excludedPlugins;
isExcluded = p: builtins.elem (lib.getName p.plugin) excludedNames;

partitionedPlugins = builtins.partition isExcluded normalizedPlugins;

byteCompile =
p:
(builders.byteCompileLuaDrv p).overrideAttrs (
prev: lib.optionalAttrs (prev ? dependencies) { dependencies = map byteCompile prev.dependencies; }
);
in
mapNormalizedPlugins byteCompile
(mapNormalizedPlugins byteCompile partitionedPlugins.wrong) ++ partitionedPlugins.right
5 changes: 4 additions & 1 deletion modules/top-level/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ in
build.plugins =
let
shouldCompilePlugins = byteCompileCfg.enable && byteCompileCfg.plugins;
byteCompilePlugins = pkgs.callPackage ./byte-compile-plugins.nix { inherit lib; };
byteCompilePlugins = pkgs.callPackage ./byte-compile-plugins.nix {
inherit lib;
inherit (config.performance.byteCompileLua) excludedPlugins;
};

shouldCompileLuaLib = byteCompileCfg.enable && byteCompileCfg.luaLib;
inherit (pkgs.callPackage ./byte-compile-lua-lib.nix { inherit lib; }) byteCompilePluginDeps;
Expand Down