2025-04-01 10:18:15 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
2024-07-07 20:22:39 +03:00
|
|
|
let
|
|
|
|
inherit (lib) types;
|
2025-04-01 10:18:15 +02:00
|
|
|
cfg = config.performance;
|
2024-07-07 20:22:39 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.performance = {
|
2024-07-25 13:25:13 +03:00
|
|
|
byteCompileLua = {
|
|
|
|
enable = lib.mkEnableOption "byte compiling of lua files";
|
|
|
|
initLua = lib.mkOption {
|
|
|
|
description = "Whether to byte compile init.lua.";
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
};
|
2024-07-25 18:09:16 +03:00
|
|
|
configs = lib.mkOption {
|
|
|
|
description = "Whether to byte compile lua configuration files.";
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
};
|
2024-07-17 21:06:30 +03:00
|
|
|
plugins = lib.mkEnableOption "plugins" // {
|
|
|
|
description = "Whether to byte compile lua plugins.";
|
|
|
|
};
|
2024-07-17 22:26:06 +03:00
|
|
|
nvimRuntime = lib.mkEnableOption "nvimRuntime" // {
|
|
|
|
description = "Whether to byte compile lua files in Nvim runtime.";
|
|
|
|
};
|
2024-07-25 13:25:13 +03:00
|
|
|
};
|
|
|
|
|
2024-07-07 20:22:39 +03:00
|
|
|
combinePlugins = {
|
|
|
|
enable = lib.mkEnableOption "combinePlugins" // {
|
|
|
|
description = ''
|
|
|
|
Whether to enable EXPERIMENTAL option to combine all plugins
|
|
|
|
into a single plugin pack. It can significantly reduce startup time,
|
|
|
|
but all your plugins must have unique filenames and doc tags.
|
2024-07-19 16:31:12 +03:00
|
|
|
Any collision will result in a build failure. To avoid collisions
|
|
|
|
you can add your plugin to the `standalonePlugins` option.
|
2024-07-07 20:22:39 +03:00
|
|
|
Only standard neovim runtime directories are linked to the combined plugin.
|
|
|
|
If some of your plugins contain important files outside of standard
|
|
|
|
directories, add these paths to `pathsToLink` option.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
pathsToLink = lib.mkOption {
|
|
|
|
type = with types; listOf str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "/data" ];
|
|
|
|
description = "List of paths to link into a combined plugin pack.";
|
|
|
|
};
|
2024-07-19 16:31:12 +03:00
|
|
|
standalonePlugins = lib.mkOption {
|
|
|
|
type = with types; listOf (either str package);
|
|
|
|
default = [ ];
|
|
|
|
example = [ "nvim-treesitter" ];
|
|
|
|
description = "List of plugins (names or packages) to exclude from plugin pack.";
|
|
|
|
};
|
2024-07-07 20:22:39 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-04-01 10:18:15 +02:00
|
|
|
# FIXME: The performance options do not correctly propagate lua module dependencies.
|
|
|
|
# We can explicitly specify 'plenary-nvim', as it is a very common dependency.
|
|
|
|
# While this is enough for our test suite to pass, end-users may be affected by other dependencies not covered by our test suite.
|
|
|
|
#
|
|
|
|
# See https://github.com/nix-community/nixvim/pull/3099
|
|
|
|
config.extraPlugins =
|
|
|
|
lib.mkIf (cfg.combinePlugins.enable || (cfg.byteCompileLua.enable && cfg.byteCompileLua.plugins))
|
|
|
|
[
|
|
|
|
pkgs.vimPlugins.plenary-nvim
|
|
|
|
];
|
|
|
|
|
2024-07-07 20:22:39 +03:00
|
|
|
config.performance = {
|
|
|
|
# Set option value with default priority so that values are appended by default
|
|
|
|
combinePlugins.pathsToLink = [
|
|
|
|
# :h rtp
|
|
|
|
"/autoload"
|
|
|
|
"/colors"
|
|
|
|
"/compiler"
|
|
|
|
"/doc"
|
|
|
|
"/ftplugin"
|
|
|
|
"/indent"
|
|
|
|
"/keymap"
|
|
|
|
"/lang"
|
|
|
|
"/lua"
|
|
|
|
"/pack"
|
|
|
|
"/parser"
|
|
|
|
"/plugin"
|
|
|
|
"/queries"
|
|
|
|
"/rplugin"
|
|
|
|
"/spell"
|
|
|
|
"/syntax"
|
|
|
|
"/tutor"
|
|
|
|
"/after"
|
|
|
|
# ftdetect
|
|
|
|
"/ftdetect"
|
2024-07-16 14:45:12 +03:00
|
|
|
# plenary.nvim
|
|
|
|
"/data/plenary/filetypes"
|
2024-07-07 20:22:39 +03:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|