diff --git a/lib/types/default.nix b/lib/types/default.nix index bfaa38d..59a5181 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -4,6 +4,6 @@ typesLanguage = import ./languages.nix {inherit lib;}; in { inherit (typesDag) dagOf; - inherit (typesPlugin) pluginsOpt extraPluginType; + inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption; inherit (typesLanguage) diagnostics mkGrammarOption; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index ee33a42..bcc1dda 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -138,4 +138,25 @@ in { inherit description default; type = pluginsType; }; + + # opts is a attrset of options, example: + # ``` + # mkPluginSetupOption "telescope" { + # file_ignore_patterns = mkOption { + # description = "..."; + # type = types.listOf types.str; + # default = []; + # }; + # layout_config.horizontal = mkOption {...}; + # } + # ``` + mkPluginSetupOption = pluginName: opts: + mkOption { + description = "Option table to pass into the setup function of " + pluginName; + default = {}; + type = types.submodule { + freeformType = with types; attrsOf anything; + options = opts; + }; + }; }