Skip to content

Commit 6348336

Browse files
committed
modules/lazyload: init w/ assertion
Adds a global lazyloading assertion. No module options yet.
1 parent 3888522 commit 6348336

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

modules/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
./filetype.nix
1717
./highlights.nix
1818
./keymaps.nix
19+
./lazyload.nix
1920
./lua-loader.nix
2021
./opts.nix
2122
./output.nix

modules/lazyload.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}:
6+
let
7+
implementations = [
8+
"lz-n"
9+
"lazy"
10+
];
11+
in
12+
{
13+
config = {
14+
assertions =
15+
let
16+
enabled = builtins.filter (x: config.plugins.${x}.enable) implementations;
17+
count = builtins.length enabled;
18+
in
19+
[
20+
{
21+
assertion = count < 2;
22+
message = ''
23+
You have multiple lazy-loaders enabled:
24+
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") enabled}
25+
Please ensure only one is enabled at a time.
26+
'';
27+
}
28+
];
29+
};
30+
}

0 commit comments

Comments
 (0)