mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-06 19:05:26 +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, ... }: {
|
||||
name,
|
||||
description,
|
||||
package ? null,
|
||||
extraPlugins ? [],
|
||||
extraPackages ? [],
|
||||
options ? {},
|
||||
|
@ -81,13 +82,23 @@ rec {
|
|||
name = opt.global;
|
||||
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
||||
}) 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 {
|
||||
options.plugins.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
} // pluginOptions;
|
||||
} // packageOption // pluginOptions;
|
||||
|
||||
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