mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 02:34:34 +02:00
modules/lazyload: init w/ assertion
Adds a global lazyloading assertion. No module options yet.
This commit is contained in:
parent
3888522746
commit
6348336db0
2 changed files with 31 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
./filetype.nix
|
./filetype.nix
|
||||||
./highlights.nix
|
./highlights.nix
|
||||||
./keymaps.nix
|
./keymaps.nix
|
||||||
|
./lazyload.nix
|
||||||
./lua-loader.nix
|
./lua-loader.nix
|
||||||
./opts.nix
|
./opts.nix
|
||||||
./output.nix
|
./output.nix
|
||||||
|
|
30
modules/lazyload.nix
Normal file
30
modules/lazyload.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
implementations = [
|
||||||
|
"lz-n"
|
||||||
|
"lazy"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
assertions =
|
||||||
|
let
|
||||||
|
enabled = builtins.filter (x: config.plugins.${x}.enable) implementations;
|
||||||
|
count = builtins.length enabled;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
{
|
||||||
|
assertion = count < 2;
|
||||||
|
message = ''
|
||||||
|
You have multiple lazy-loaders enabled:
|
||||||
|
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") enabled}
|
||||||
|
Please ensure only one is enabled at a time.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue