mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
This commit adds support for byte compiling lua configuration files. It's enabled by default (if byte compiling is enabled at all) and can be disabled with `performance.byteCompileLua.configs` toggle. To implement this feature `extraFiles.<name>.finalSource` internal read-only option is introduced. `source` option cannot be used because it's user configurable. In order to access the values of the `performance.byteCompileLua` options, parent config is added to specialArgs of extraFiles submodule. Then the usages of `source` option changed to `finalSource` in all relevant places (filesPlugin and wrappers). Added more helpers for various cases of byte compiling: * `byteCompileLuaFile` byte compiles lua file * `byteCompileLuaHook` is a setup hook that byte compiles all lua files * `byteCompileLuaDrv` overrides derivation by adding byteCompileLuaHook to it Added tests to validate that extraFiles specified by various methods are handled correctly. Added a separate home-manager test, that is intended to validate that extraFiles propagated to wrapper modules are correctly byte compiled.
79 lines
2.2 KiB
Nix
79 lines
2.2 KiB
Nix
{ lib, ... }:
|
|
let
|
|
inherit (lib) types;
|
|
in
|
|
{
|
|
options.performance = {
|
|
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;
|
|
};
|
|
configs = lib.mkOption {
|
|
description = "Whether to byte compile lua configuration files.";
|
|
type = types.bool;
|
|
default = true;
|
|
example = false;
|
|
};
|
|
};
|
|
|
|
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.
|
|
Any collision will result in a build failure. To avoid collisions
|
|
you can add your plugin to the `standalonePlugins` option.
|
|
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.";
|
|
};
|
|
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.";
|
|
};
|
|
};
|
|
};
|
|
|
|
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"
|
|
# plenary.nvim
|
|
"/data/plenary/filetypes"
|
|
];
|
|
};
|
|
}
|