Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
noxfile.py: On Nix, auto-patch binaries installed by Nox
On Nix/NixOS, when Nox installs a dependency into its own virtualenv, any pre-built binaries that are installed will break hermeticity (and on NixOS w/o nix-ld, they will fail to execute at all). Nix usually solves this by running patchElf when installing pre-built binaries, to point them to the Nix-provided (and thus hermetic) loader + shared libs. But what to do when the pre-built binaries are not provided by Nix? We have already solved this for binaries installed by Poetry virtualenv: In our shell.nix, we run `autoPatchelf` on the Poetry virtualenv after Poetry has populated it. This commit does the same for the virtualenvs setup/managed by Nox: When install_groups() has finished installing the dependencies into the virtualenv provided by Nox, we check to see if we're running on Nix (specifically, we check if auto-patchelf-hook is in our $buildInputs, which signifies that we're running inside our nix-shell), and then we use the same nix-shell to run `autoPatchelf` on the Nox virtualenv. This allows us to use Python dependencies with pre-built binaries, not only in the Poetry dev environemnt, but also in the test environments managed by Nox.
- Loading branch information