Skip to content

Commit

Permalink
Pass nix-ld related variables by default in pass_env (fixes #3425) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodonato authored Nov 1, 2024
1 parent 5d880fc commit 324dfe5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/changelog/3425.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pass ``NIX_LD`` and ``NIX_LD_LIBRARY_PATH`` variables by default in ``pass_env`` to make generic binaries work under Nix/NixOS.

- by :user:`albertodonato`
8 changes: 8 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,14 @@ Base options
- ✅
- ✅
- ✅
* - NIX_LD*
- ✅
- ✅
- ❌
* - NIX_LD_LIBRARY_PATH
- ✅
- ✅
- ❌



Expand Down
8 changes: 7 additions & 1 deletion src/tox/tox_env/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301
],
)
else: # pragma: win32 no cover
env.append("TMPDIR") # temporary file location
env.extend(
[
"TMPDIR", # temporary file location
"NIX_LD", # nix-ld loader
"NIX_LD_LIBRARY_PATH", # nix-ld library path
],
)
return env

def setup(self) -> None:
Expand Down
4 changes: 3 additions & 1 deletion tests/session/cmd/test_show_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
+ ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "FORCE_COLOR", "HOME", "LANG"]
+ ["LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"]
+ (["MSYSTEM"] if is_win else [])
+ ["NETRC", "NO_COLOR"]
+ ["NETRC"]
+ (["NIX_LD", "NIX_LD_LIBRARY_PATH"] if not is_win else [])
+ ["NO_COLOR"]
+ (["NUMBER_OF_PROCESSORS", "PATHEXT"] if is_win else [])
+ ["PIP_*", "PKG_CONFIG", "PKG_CONFIG_PATH", "PKG_CONFIG_SYSROOT_DIR"]
+ (["PROCESSOR_ARCHITECTURE"] if is_win else [])
Expand Down

0 comments on commit 324dfe5

Please sign in to comment.