helpers/vim-plugin/mkVimPlugin: rename extraConfig to settings (RFC 42)

This commit is contained in:
Gaetan Lepage 2024-02-12 12:07:50 +01:00 committed by Gaétan Lepage
parent 2d7c834866
commit 54da635d45

View file

@ -11,6 +11,7 @@ with lib; {
extraPackages ? [],
options ? {},
globalPrefix ? "",
addExtraConfigRenameWarning ? false,
...
}: let
cfg = config.plugins.${name};
@ -44,10 +45,12 @@ with lib; {
package = nixvimOptions.mkPackageOption name package;
};
createSettingsOption = (isString globalPrefix) && (globalPrefix != "");
extraConfigOption =
if (isString globalPrefix) && (globalPrefix != "")
then {
extraConfig = mkOption {
optionalAttrs createSettingsOption
{
settings = mkOption {
type = with types; attrsOf anything;
description = ''
The configuration options for ${name} without the '${globalPrefix}' prefix.
@ -60,8 +63,7 @@ with lib; {
'';
default = {};
};
}
else {};
};
in {
options.plugins.${name} =
{
@ -75,6 +77,12 @@ with lib; {
// packageOption
// pluginOptions;
imports = optional (addExtraConfigRenameWarning && createSettingsOption) (
mkRenamedOptionModule
["plugins" name "extraConfig"]
["plugins" name "settings"]
);
config = mkIf cfg.enable {
inherit extraPackages globals;
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.