mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 14:11:21 +00:00
lib/types.nix: add nonEmptyStr
This commit is contained in:
parent
ba1af18d27
commit
a3c5f0cba8
@ -287,6 +287,13 @@ rec {
|
||||
merge = mergeEqualOption;
|
||||
};
|
||||
|
||||
nonEmptyStr = mkOptionType {
|
||||
name = "nonEmptyStr";
|
||||
description = "non-empty string";
|
||||
check = x: str.check x && builtins.match "[ \t\n]*" x == null;
|
||||
inherit (str) merge;
|
||||
};
|
||||
|
||||
strMatching = pattern: mkOptionType {
|
||||
name = "strMatching ${escapeNixString pattern}";
|
||||
description = "string matching the pattern ${pattern}";
|
||||
|
Loading…
Reference in New Issue
Block a user