mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
lib/types.nix: add nonEmptyStr
This commit is contained in:
parent
ba1af18d27
commit
a3c5f0cba8
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue