Skip to content

Consider passing NIX_LD_* env vars by default for Nix/NixOS #3425

Closed
@albertodonato

Description

What's the problem this feature will solve?

Running pre-compiled binaries (e.g. ruff) under tox doesn't work out of the box on Nix/NixOS.

This is because of the way Nix manages libraries dependencies.
The solution for that is to use Nix-ld, which provides a shim loader.
This relies on the NIX_LD* variables to be set. Those variables are not passed in by tox by default, which requires to add pass_env statements that are OS-specific to the tox config.

Describe the solution you'd like

It would be nice if tox could also pass NIX_LD* variables by default to envs, removing the need for manual configuration.

Additional context

Example of the failure mentioned above:

$ tox run -e format
format: commands[0]> ruff format toolrack tests
cannot execute /home/ack/devel/git/toolrack/.tox/format/bin/ruff: You are trying to run an unpatched binary on nixos, but you have not configured NIX_LD or NIX_LD_x86_64-linux. See https://github.com/Mic92/nix-ld for more details
format: exit 1 (0.00 seconds) /home/ack/devel/git/toolrack> ruff format toolrack tests pid=272941
  format: FAIL code 1 (0.03=setup[0.03]+cmd[0.00] seconds)
  evaluation failed :( (0.06 seconds)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions