summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2021-07-20 05:17:35 +0300
committerArtturin <Artturin@artturin.com>2021-07-20 20:51:27 +0300
commita3c5f0cba8fa9c4d9782ef83757be6e4028f54b7 (patch)
treeaeb7550b558046d7d3ea0d283d2f3fe71b0323bc /lib
parentba1af18d2710ee1f6519ca9d91d0fc0b8de336e8 (diff)
downloadnixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar.gz
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar.bz2
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar.lz
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar.xz
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.tar.zst
nixpkgs-a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7.zip
lib/types.nix: add nonEmptyStr
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index f47a1f92de7..68262951a13 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -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}";