mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/lua-loader: add support for the new lua-loader (#336)
This commit is contained in:
parent
8ba084783e
commit
a9e3ff3f73
2 changed files with 44 additions and 0 deletions
35
modules/lua-loader.nix
Normal file
35
modules/lua-loader.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.luaLoader;
|
||||||
|
in {
|
||||||
|
options.luaLoader = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable/disable the experimental lua loader:
|
||||||
|
|
||||||
|
If `true`: Enables the experimental Lua module loader:
|
||||||
|
- overrides loadfile
|
||||||
|
- adds the lua loader using the byte-compilation cache
|
||||||
|
- adds the libs loader
|
||||||
|
- removes the default Neovim loade
|
||||||
|
|
||||||
|
If `false`: Disables the experimental Lua module loader:
|
||||||
|
- removes the loaders
|
||||||
|
- adds the default Neovim loader
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
extraConfigLuaPre =
|
||||||
|
if cfg.enable
|
||||||
|
then "vim.loader.enable()"
|
||||||
|
else "vim.loader.disable()";
|
||||||
|
};
|
||||||
|
}
|
9
tests/test-sources/modules/lua-loader.nix
Normal file
9
tests/test-sources/modules/lua-loader.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
enabled = {
|
||||||
|
luaLoader.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
disabled = {
|
||||||
|
luaLoader.enable = false;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue