From 47acf325d649c2f86a250821d0b93d08f926a8dd Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 3 Mar 2024 11:47:58 +0000 Subject: [PATCH] dev: add custom type rawLua --- lib/types/default.nix | 2 +- lib/types/plugins.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/types/default.nix b/lib/types/default.nix index 59a5181..22b728d 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 mkPluginSetupOption; + inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption rawLua; inherit (typesLanguage) diagnostics mkGrammarOption; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index da1d6ba..813108f 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -145,6 +145,18 @@ in { 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: # ``` # mkPluginSetupOption "telescope" {