1diff --git a/certifi/core.py b/certifi/core.py
2index 1c9661c..7039be3 100644
3--- a/certifi/core.py
4+++ b/certifi/core.py
5@@ -4,6 +4,7 @@ certifi.py
6
7 This module returns the installation location of cacert.pem or its contents.
8 """
9+import os
10 import sys
11 import atexit
12
13@@ -11,12 +12,21 @@ def exit_cacert_ctx() -> None:
14 _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
15
16
17+def get_cacert_path_from_environ():
18+ path = os.environ.get("NIX_SSL_CERT_FILE", None)
19+
20+ if path == "/no-cert-file.crt":
21+ return None
22+
23+ return path
24+
25+
26 if sys.version_info >= (3, 11):
27
28 from importlib.resources import as_file, files
29
30 _CACERT_CTX = None
31- _CACERT_PATH = None
32+ _CACERT_PATH = get_cacert_path_from_environ()
33
34 def where() -> str:
35 # This is slightly terrible, but we want to delay extracting the file
36@@ -44,6 +54,8 @@ if sys.version_info >= (3, 11):
37 return _CACERT_PATH
38
39 def contents() -> str:
40+ if _CACERT_PATH is not None:
41+ return open(_CACERT_PATH, encoding="utf-8").read()
42 return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
43
44 else:
45@@ -51,7 +63,7 @@ else:
46 from importlib.resources import path as get_path, read_text
47
48 _CACERT_CTX = None
49- _CACERT_PATH = None
50+ _CACERT_PATH = get_cacert_path_from_environ()
51
52 def where() -> str:
53 # This is slightly terrible, but we want to delay extracting the