lazyUtils: plugin.dir and plugin.dependencies now have to be functions.

This commit is contained in:
Kevin Baensch 2025-05-03 20:38:32 +02:00
parent ea8a4592cb
commit 6d882feee4
Signed by: derped
GPG key ID: C0F1D326C7626543
2 changed files with 3 additions and 19 deletions

View file

@ -45,13 +45,7 @@ let
description = ''Short plugin url. (installation is handled by lazy.nvim)''; description = ''Short plugin url. (installation is handled by lazy.nvim)'';
}; };
dir = mkOption { dir = mkOption {
type = type = types.nullOr (vPlugFunctionType);
with types;
nullOr (oneOf [
path
package
vPlugFunctionType
]);
default = null; default = null;
description = ''A vim plugin package or a path pointing to a local plugin.''; description = ''A vim plugin package or a path pointing to a local plugin.'';
}; };
@ -96,17 +90,7 @@ let
description = ''When false, or if the function returns false, then this plugin will not be loaded. Useful to disable some plugins in vscode, or firenvim for example.''; description = ''When false, or if the function returns false, then this plugin will not be loaded. Useful to disable some plugins in vscode, or firenvim for example.'';
}; };
dependencies = mkOption { dependencies = mkOption {
type = type = types.nullOr (vPlugFunctionType);
with types;
nullOr (
(oneOf [
vPlugFunctionType
(listOf (oneOf [
str
package
]))
])
);
default = null; default = null;
description = ''A list of plugin names or plugin specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise. When specifying a name, make sure the plugin spec has been defined somewhere else.''; description = ''A list of plugin names or plugin specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise. When specifying a name, make sure the plugin spec has been defined somewhere else.'';
}; };

View file

@ -121,7 +121,7 @@ let
if (builtins.isNull val) then val else fn val; if (builtins.isNull val) then val else fn val;
# Wrap function arguments in function so they are inserted as is when parsed. # Wrap function arguments in function so they are inserted as is when parsed.
stringLiteral = value: if (builtins.isString value) then (_: value) else value; stringLiteral = value: if (builtins.isString value) then (_: value) else value;
resolvePlugin = value: if (builtins.isFunction value) then value vPlug else value; resolvePlugin = pluginFn: pluginFn vPlug;
in in
lib.pipe plugin [ lib.pipe plugin [
# Resolve dir and dependencies first so getName can resolve names # Resolve dir and dependencies first so getName can resolve names