summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2022-01-18 23:56:50 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-01-21 16:44:03 +0000
commit03dc83a53c378d599b4aa8ace558f2b29de02fdf (patch)
tree29bbe2b217b6a77d575aa7f0d63bed633209d3f7
parenttypes.singleLineStr: strings that don't contain '\n' (diff)
downloadnixpkgs-03dc83a53c378d599b4aa8ace558f2b29de02fdf.tar.gz
types.singleLineStr: Disallow \r
(cherry picked from commit f25a13212be9bd716db9420a59cb74ecab02937a)
-rw-r--r--lib/types.nix5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 0e702fb2f2ed..18e95caaee84 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 {