dev: add custom type rawLua

This commit is contained in:
Ching Pei Yang 2024-03-03 11:47:58 +00:00
parent 0e802c03ef
commit 47acf325d6
2 changed files with 13 additions and 1 deletions

View file

@ -4,6 +4,6 @@
typesLanguage = import ./languages.nix {inherit lib;}; typesLanguage = import ./languages.nix {inherit lib;};
in { in {
inherit (typesDag) dagOf; inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption rawLua;
inherit (typesLanguage) diagnostics mkGrammarOption; inherit (typesLanguage) diagnostics mkGrammarOption;
} }

View file

@ -145,6 +145,18 @@ in {
type = pluginsType; type = pluginsType;
}; };
rawLua = lib.mkOptionType {
name = "rawLua";
check = val: isString val || val ? __raw;
merge = loc: defs: let
val =
if isString loc
then {__raw = val;}
else loc;
in
lib.mergeOneOption val defs;
};
# opts is a attrset of options, example: # opts is a attrset of options, example:
# ``` # ```
# mkPluginSetupOption "telescope" { # mkPluginSetupOption "telescope" {