Skip to content

[Backport release-25.11] virtualisation/rosetta: Perserve ArgvZero to fix python virtualenv creation#465308

Merged
SuperSandro2000 merged 1 commit intorelease-25.11from
backport-463106-to-release-25.11
Nov 28, 2025
Merged

[Backport release-25.11] virtualisation/rosetta: Perserve ArgvZero to fix python virtualenv creation#465308
SuperSandro2000 merged 1 commit intorelease-25.11from
backport-463106-to-release-25.11

Conversation

@nixpkgs-ci
Copy link
Contributor

@nixpkgs-ci nixpkgs-ci bot commented Nov 26, 2025

Bot-based backport to release-25.11, triggered by a label in #463106.

Before merging, ensure that this backport is acceptable for the release.

Even as a non-committer, if you find that it is not acceptable, leave a comment.

…eation

Preserving ArgvZero is supported from MacOS 14 Sonoma forward, which is
the current minimum supported version of nixpkgs. See
https://developer.apple.com/documentation/virtualization/running-intel-binaries-in-linux-vms-with-rosetta#Mount-the-Shared-Directory-and-Register-Rosetta

The necessity of this fix came up with python virtual environments,
because python uses the path of the executable (argv zero) to determine
if it should load a virtual environment or not. In the past this was
overriden with NIX_PYTHONEXECUTABLE, NIX_PYTHONPATH and
NIX_PYTHONPREFIX, but we stopped doing that for the python interpreter
so it works more like a normal python interpreter in nix.

Without those variables, in the rosetta emulated case, python was no
longer able to determine where it was called from, and thus could not
correctly activate virtual environments in that case.

(cherry picked from commit f5eb10b)
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 4.workflow: backport This targets a stable branch labels Nov 26, 2025
@SuperSandro2000 SuperSandro2000 added this pull request to the merge queue Nov 28, 2025
Merged via the queue into release-25.11 with commit a515f8d Nov 28, 2025
34 of 36 checks passed
@SuperSandro2000 SuperSandro2000 deleted the backport-463106-to-release-25.11 branch November 28, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.workflow: backport This targets a stable branch 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants