mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-07 19:35:01 +02:00
helpers: added package option to mkPlugin
This commit is contained in:
parent
39261bff6b
commit
0154d0ae46
1 changed files with 13 additions and 2 deletions
|
@ -69,6 +69,7 @@ rec {
|
||||||
mkPlugin = { config, lib, ... }: {
|
mkPlugin = { config, lib, ... }: {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
package ? null,
|
||||||
extraPlugins ? [],
|
extraPlugins ? [],
|
||||||
extraPackages ? [],
|
extraPackages ? [],
|
||||||
options ? {},
|
options ? {},
|
||||||
|
@ -81,13 +82,23 @@ rec {
|
||||||
name = opt.global;
|
name = opt.global;
|
||||||
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
||||||
}) options;
|
}) options;
|
||||||
|
# does this evaluate package?
|
||||||
|
packageOption = if package == null then { } else {
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = package;
|
||||||
|
description = "Plugin to use for ${name}";
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.plugins.${name} = {
|
options.plugins.${name} = {
|
||||||
enable = mkEnableOption description;
|
enable = mkEnableOption description;
|
||||||
} // pluginOptions;
|
} // packageOption // pluginOptions;
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
inherit extraPlugins extraPackages globals;
|
inherit extraPackages globals;
|
||||||
|
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
||||||
|
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue