From 5bcb6184b0c1ef2c16e79db964eb1d0f639ba4df Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 31 May 2024 19:17:43 +0100 Subject: [PATCH] lib/options: add `mkNullOrStrLuaOr'` variant --- lib/options.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index ba715b71..20fc4a8e 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -54,14 +54,16 @@ rec { ); mkNullOrLuaFn = description: mkNullOrLua' { inherit description; }; - mkNullOrStrLuaOr = - ty: desc: - lib.mkOption { - type = lib.types.nullOr (types.either nixvimTypes.strLua ty); - default = null; - description = desc; - apply = v: if builtins.isString v then mkRaw v else v; - }; + mkNullOrStrLuaOr' = + { type, ... }@args: + mkNullOrOption' ( + args + // { + type = with nixvimTypes; either strLua type; + apply = v: if isString v then mkRaw v else v; + } + ); + mkNullOrStrLuaOr = type: description: mkNullOrStrLuaOr' { inherit type description; }; mkNullOrStrLuaFnOr = ty: desc: