Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass nix-ld related variables by default in pass_env (fixes #3425) #3434

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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