From 087c5f5325c46485a9bc5f8e7f2620af6bf6bf56 Mon Sep 17 00:00:00 2001
From: Michael Fellinger <michael.fellinger@iohk.io>
Date: Mon, 5 Jul 2021 12:00:08 +0200
Subject: [PATCH] Fix devShell handling of env values including @ and %

---
 src/nix/develop.cc | 2 +-
 tests/shell.nix    | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 6c089469d..699ec0b99 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -54,7 +54,7 @@ BuildEnvironment readEnvironment(const Path & path)
         R"re((?:[a-zA-Z_][a-zA-Z0-9_]*))re";
 
     static std::string simpleStringRegex =
-        R"re((?:[a-zA-Z0-9_/:\.\-\+=]*))re";
+        R"re((?:[a-zA-Z0-9_/:\.\-\+=@%]*))re";
 
     static std::string dquotedStringRegex =
         R"re((?:\$?"(?:[^"\\]|\\[$`"\\\n])*"))re";
diff --git a/tests/shell.nix b/tests/shell.nix
index 53759f99a..f174db583 100644
--- a/tests/shell.nix
+++ b/tests/shell.nix
@@ -34,6 +34,8 @@ let pkgs = rec {
     name = "shellDrv";
     builder = "/does/not/exist";
     VAR_FROM_NIX = "bar";
+    ASCII_PERCENT = "%";
+    ASCII_AT = "@";
     TEST_inNixShell = if inNixShell then "true" else "false";
     inherit stdenv;
     outputs = ["dev" "out"];