mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-04 20:52:21 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I90ce0f42984ffbca9dfbdf4d97d2fc636a6a6964
28 lines
787 B
Nix
28 lines
787 B
Nix
{lib}: let
|
|
inherit (lib.options) mergeEqualOption;
|
|
inherit (lib.strings) isString stringLength match;
|
|
inherit (lib.types) listOf mkOptionType;
|
|
in {
|
|
mergelessListOf = elemType:
|
|
mkOptionType {
|
|
name = "mergelessListOf";
|
|
description = "mergeless list of ${elemType.description or "values"}";
|
|
inherit (lib.types.listOf elemType) check;
|
|
merge = mergeEqualOption;
|
|
};
|
|
|
|
char = mkOptionType {
|
|
name = "char";
|
|
description = "character";
|
|
descriptionClass = "noun";
|
|
check = value: stringLength value < 2;
|
|
merge = mergeEqualOption;
|
|
};
|
|
|
|
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;
|
|
};
|
|
}
|