2024-07-11 22:49:44 +00:00
|
|
|
{lib}: let
|
2024-12-22 22:00:26 +00:00
|
|
|
inherit (lib.options) mergeEqualOption;
|
|
|
|
inherit (lib.strings) isString stringLength match;
|
|
|
|
inherit (lib.types) listOf mkOptionType;
|
2024-07-11 22:49:44 +00:00
|
|
|
in {
|
2024-10-09 17:50:34 +00:00
|
|
|
mergelessListOf = elemType: let
|
|
|
|
super = listOf elemType;
|
|
|
|
in
|
|
|
|
super
|
|
|
|
// {
|
|
|
|
name = "mergelessListOf";
|
|
|
|
description = "mergeless ${super.description}";
|
|
|
|
merge = mergeEqualOption;
|
|
|
|
};
|
|
|
|
|
2024-07-12 15:47:33 +00:00
|
|
|
char = mkOptionType {
|
|
|
|
name = "char";
|
|
|
|
description = "character";
|
|
|
|
descriptionClass = "noun";
|
|
|
|
check = value: stringLength value < 2;
|
|
|
|
merge = mergeEqualOption;
|
|
|
|
};
|
2024-10-05 13:47:33 +00:00
|
|
|
|
|
|
|
hexColor = mkOptionType {
|
|
|
|
name = "hex-color";
|
|
|
|
descriptionClass = "noun";
|
|
|
|
description = "RGB color in hex format";
|
|
|
|
check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null;
|
|
|
|
};
|
2024-07-11 22:49:44 +00:00
|
|
|
}
|