lib/types: allow assigning raw lua to string lua

Relax the check a little to allow (slightly) incorrect usage and enable migrating option types to string lua types.
This commit is contained in:
Matt Sturgeon 2024-06-16 22:39:53 +01:00
parent 2d063c2c24
commit 36b4a39b2b
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -9,12 +9,13 @@ let
name = "str"; name = "str";
inherit description; inherit description;
descriptionClass = "noun"; descriptionClass = "noun";
check = lib.isString; check = v: isString v || isRawType v;
merge = lib.options.mergeEqualOption; merge = lib.options.mergeEqualOption;
}; };
isRawType = v: v ? __raw && isString v.__raw;
in in
rec { rec {
isRawType = v: v ? __raw && isString v.__raw; inherit isRawType;
rawLua = mkOptionType { rawLua = mkOptionType {
name = "rawLua"; name = "rawLua";