modules/lazyload: init w/ assertion

Adds a global lazyloading assertion. No module options yet.
This commit is contained in:
Matt Sturgeon 2024-12-05 20:47:26 +00:00
parent 3888522746
commit 6348336db0
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 31 additions and 0 deletions

View file

@ -16,6 +16,7 @@
./filetype.nix
./highlights.nix
./keymaps.nix
./lazyload.nix
./lua-loader.nix
./opts.nix
./output.nix

30
modules/lazyload.nix Normal file
View 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.
'';
}
];
};
}