mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-25 02:08:40 +02:00
helpers/vim-plugin/mkVimPlugin: rename extraConfig to settings (RFC 42)
This commit is contained in:
parent
2d7c834866
commit
54da635d45
1 changed files with 13 additions and 5 deletions
|
@ -11,6 +11,7 @@ with lib; {
|
||||||
extraPackages ? [],
|
extraPackages ? [],
|
||||||
options ? {},
|
options ? {},
|
||||||
globalPrefix ? "",
|
globalPrefix ? "",
|
||||||
|
addExtraConfigRenameWarning ? false,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cfg = config.plugins.${name};
|
cfg = config.plugins.${name};
|
||||||
|
@ -44,10 +45,12 @@ with lib; {
|
||||||
package = nixvimOptions.mkPackageOption name package;
|
package = nixvimOptions.mkPackageOption name package;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
createSettingsOption = (isString globalPrefix) && (globalPrefix != "");
|
||||||
|
|
||||||
extraConfigOption =
|
extraConfigOption =
|
||||||
if (isString globalPrefix) && (globalPrefix != "")
|
optionalAttrs createSettingsOption
|
||||||
then {
|
{
|
||||||
extraConfig = mkOption {
|
settings = mkOption {
|
||||||
type = with types; attrsOf anything;
|
type = with types; attrsOf anything;
|
||||||
description = ''
|
description = ''
|
||||||
The configuration options for ${name} without the '${globalPrefix}' prefix.
|
The configuration options for ${name} without the '${globalPrefix}' prefix.
|
||||||
|
@ -60,8 +63,7 @@ with lib; {
|
||||||
'';
|
'';
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
else {};
|
|
||||||
in {
|
in {
|
||||||
options.plugins.${name} =
|
options.plugins.${name} =
|
||||||
{
|
{
|
||||||
|
@ -75,6 +77,12 @@ with lib; {
|
||||||
// packageOption
|
// packageOption
|
||||||
// pluginOptions;
|
// pluginOptions;
|
||||||
|
|
||||||
|
imports = optional (addExtraConfigRenameWarning && createSettingsOption) (
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["plugins" name "extraConfig"]
|
||||||
|
["plugins" name "settings"]
|
||||||
|
);
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
inherit extraPackages globals;
|
inherit extraPackages globals;
|
||||||
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue