lib/types.nix: add nonEmptyStr

This commit is contained in:
Artturin 2021-07-20 05:17:35 +03:00
parent ba1af18d27
commit a3c5f0cba8

View File

@ -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}";