summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2022-01-18 23:56:50 +0100
committerJules Aguillon <jules@j3s.fr>2022-01-18 23:56:50 +0100
commitf25a13212be9bd716db9420a59cb74ecab02937a (patch)
tree10e8055c3ca33e651d70d83f3c68784abb3f7a0a /lib/types.nix
parentdf590070b007b2cd2f64647b2780c903506aa21f (diff)
downloadnixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar.gz
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar.bz2
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar.lz
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar.xz
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.tar.zst
nixpkgs-f25a13212be9bd716db9420a59cb74ecab02937a.zip
types.singleLineStr: Disallow \r
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 0e702fb2f2e..18e95caaee8 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -302,9 +302,8 @@ rec {
 
     singleLineStr = mkOptionType {
       name = "singleLineStr";
-      description = "string that doesn't contain '\\n'";
-      check = x: str.check x && !(lib.hasInfix "\n" x);
-      inherit (str) merge;
+      description = "string that doesn't contain [\\n\\r]";
+      inherit (strMatching "[^\n\r]*") check merge;
     };
 
     strMatching = pattern: mkOptionType {