lib/options: add mkNullOrStrLuaFnOr' variant

This commit is contained in:
Matt Sturgeon 2024-05-31 19:18:17 +01:00
parent 5bcb6184b0
commit ed56221499
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -65,14 +65,16 @@ rec {
);
mkNullOrStrLuaOr = type: description: mkNullOrStrLuaOr' { inherit type description; };
mkNullOrStrLuaFnOr =
ty: desc:
lib.mkOption {
type = lib.types.nullOr (types.either nixvimTypes.strLuaFn ty);
default = null;
description = desc;
apply = v: if builtins.isString v then mkRaw v else v;
};
mkNullOrStrLuaFnOr' =
{ type, ... }@args:
mkNullOrOption' (
args
// {
type = with nixvimTypes; either strLuaFn type;
apply = v: if isString v then mkRaw v else v;
}
);
mkNullOrStrLuaFnOr = type: description: mkNullOrStrLuaFnOr' { inherit type description; };
defaultNullOpts = rec {
/**