1diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py
2index e7315ee4..4e36b03d 100644
3--- a/src/pip/_internal/operations/install/wheel.py
4+++ b/src/pip/_internal/operations/install/wheel.py
5@@ -615,6 +615,8 @@ def install_wheel(
6 direct_url=None, # type: Optional[DirectUrl]
7 ):
8 # type: (...) -> None
9+ _temp_dir_for_testing = (
10+ _temp_dir_for_testing or os.environ.get("NIX_PIP_INSTALL_TMPDIR"))
11 with TempDirectory(
12 path=_temp_dir_for_testing, kind="unpacked-wheel"
13 ) as unpacked_dir, ZipFile(wheel_path, allowZip64=True) as z: