mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-23 04:53:27 +00:00
lib/types: allow passing raw Lua as a value to setupOpts directly
Lets users pass an entire inline Lua table to `setupOpts` for ad-hoc overrides. Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I7901c8b6e9b8d4e8c23685ad35fb507e6a6a6964
This commit is contained in:
parent
bf7fd28d79
commit
d1fdbfc0b1
1 changed files with 19 additions and 10 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||||
inherit (lib.strings) hasPrefix removePrefix;
|
inherit (lib.strings) hasPrefix removePrefix;
|
||||||
inherit (lib.types) submodule either package enum str lines anything listOf nullOr;
|
inherit (lib.types) submodule either package enum str lines anything listOf nullOr;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
|
||||||
# Get the names of all flake inputs that start with the given prefix.
|
# Get the names of all flake inputs that start with the given prefix.
|
||||||
fromInputs = {
|
fromInputs = {
|
||||||
|
|
@ -82,19 +83,27 @@ in {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
mkPluginSetupOption = pluginName: opts:
|
mkPluginSetupOption = pluginName: opts: let
|
||||||
mkOption {
|
luaOrModule =
|
||||||
description = ''
|
either (submodule {
|
||||||
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;
|
freeformType = anything;
|
||||||
options = opts;
|
options = opts;
|
||||||
};
|
})
|
||||||
|
luaInline;
|
||||||
|
in
|
||||||
|
mkOption {
|
||||||
|
type = luaOrModule;
|
||||||
|
default = {};
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Option table to pass into the setup function of ${pluginName}.
|
||||||
|
|
||||||
|
Accepts either an attribute set of options, or a raw Lua expression
|
||||||
|
via `lib.mkLuaInline`. When set to a `luaInline` value, the
|
||||||
|
expression is passed verbatim as the argument to `setup()`.
|
||||||
|
|
||||||
|
You can pass in any additional options even if they're not listed
|
||||||
|
in the docs.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue