Skip to content

Commit

Permalink
modules/lazyload: init w/ assertion
Browse files Browse the repository at this point in the history
Adds a global lazyloading assertion. No module options yet.
  • Loading branch information
MattSturgeon committed Dec 5, 2024
1 parent 3888522 commit 6348336
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
./filetype.nix
./highlights.nix
./keymaps.nix
./lazyload.nix
./lua-loader.nix
./opts.nix
./output.nix
Expand Down
30 changes: 30 additions & 0 deletions modules/lazyload.nix
Original file line number Diff line number Diff line change
@@ -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.
'';
}
];
};
}

0 comments on commit 6348336

Please sign in to comment.