mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2026-05-11 08:28:04 +02:00
types/plugins: mkPluginSetupOption' with more control
This commit is contained in:
parent
7d6909af19
commit
04e4fee620
2 changed files with 34 additions and 31 deletions
|
|
@ -9,7 +9,7 @@
|
|||
customTypes = import ./custom.nix {inherit lib;};
|
||||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption mkPluginSetupOption' luaInline pluginType borderType;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
inherit (typesLsp) mkLspPresetEnableOption;
|
||||
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf enumWithRename;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||
inherit (lib.lists) toList;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
inherit (lib.types) submodule either package enum str lines anything listOf nullOr;
|
||||
|
||||
|
|
@ -49,8 +50,39 @@
|
|||
};
|
||||
|
||||
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
|
||||
/*
|
||||
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:
|
||||
mkPluginSetupOption' pluginName { options = opts; };
|
||||
|
||||
mkPluginSetupOption' = pluginName: modules:
|
||||
mkOption {
|
||||
description = ''
|
||||
Option table to pass into the setup function of ${pluginName}
|
||||
|
||||
You can pass in any additional options even if they're
|
||||
not listed in the docs
|
||||
'';
|
||||
|
||||
default = {};
|
||||
type = submodule ((toList modules) ++ [
|
||||
{ freeformType = anything; }
|
||||
]);
|
||||
};
|
||||
in {
|
||||
inherit extraPluginType fromInputs pluginType;
|
||||
inherit extraPluginType fromInputs mkPluginSetupOption mkPluginSetupOption' pluginType;
|
||||
|
||||
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
|
||||
|
||||
|
|
@ -68,33 +100,4 @@ in {
|
|||
name = "luaInline";
|
||||
check = x: lib.nvim.lua.isLuaInline x;
|
||||
};
|
||||
|
||||
/*
|
||||
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}
|
||||
|
||||
You can pass in any additional options even if they're
|
||||
not listed in the docs
|
||||
'';
|
||||
|
||||
default = {};
|
||||
type = submodule {
|
||||
freeformType = anything;
|
||||
options = opts;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue