Skip to content

Commit 324dfe5

Browse files
Pass nix-ld related variables by default in pass_env (fixes #3425) (#3434)
1 parent 5d880fc commit 324dfe5

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

docs/changelog/3425.doc.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Pass ``NIX_LD`` and ``NIX_LD_LIBRARY_PATH`` variables by default in ``pass_env`` to make generic binaries work under Nix/NixOS.
2+
3+
- by :user:`albertodonato`

docs/config.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,14 @@ Base options
534534
- ✅
535535
- ✅
536536
- ✅
537+
* - NIX_LD*
538+
- ✅
539+
- ✅
540+
- ❌
541+
* - NIX_LD_LIBRARY_PATH
542+
- ✅
543+
- ✅
544+
- ❌
537545

538546

539547

src/tox/tox_env/api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,13 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301
236236
],
237237
)
238238
else: # pragma: win32 no cover
239-
env.append("TMPDIR") # temporary file location
239+
env.extend(
240+
[
241+
"TMPDIR", # temporary file location
242+
"NIX_LD", # nix-ld loader
243+
"NIX_LD_LIBRARY_PATH", # nix-ld library path
244+
],
245+
)
240246
return env
241247

242248
def setup(self) -> None:

tests/session/cmd/test_show_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
126126
+ ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "FORCE_COLOR", "HOME", "LANG"]
127127
+ ["LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"]
128128
+ (["MSYSTEM"] if is_win else [])
129-
+ ["NETRC", "NO_COLOR"]
129+
+ ["NETRC"]
130+
+ (["NIX_LD", "NIX_LD_LIBRARY_PATH"] if not is_win else [])
131+
+ ["NO_COLOR"]
130132
+ (["NUMBER_OF_PROCESSORS", "PATHEXT"] if is_win else [])
131133
+ ["PIP_*", "PKG_CONFIG", "PKG_CONFIG_PATH", "PKG_CONFIG_SYSROOT_DIR"]
132134
+ (["PROCESSOR_ARCHITECTURE"] if is_win else [])

0 commit comments

Comments
 (0)