-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
nix: Add FHS wrappers for venv binaries (ruff, pyrefly) on NixOS #40860
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
Conversation
91f9f94 to
d196aac
Compare
|
Thank you! This is a really cool solution and it would help us fix #37288. I've tested this on my machine and seems to work well. I just have one observation - running But I wonder if there is a way to fix this so that it always works, maybe using |
On NixOS, dynamically linked binaries from the Python venv (installed via uv/pip) cannot run directly because they expect standard Linux library paths that don't exist on NixOS. This commit adds FHS wrappers that allow these binaries to run in an FHS-compatible environment at runtime, without patching them. I considered using the nixpkgs versions of ruff and pyrefly directly, or overriding their derivations to match the versions in requirements.txt. However, decided against it because: - Version mismatches between nixpkgs and requirements.txt caused type checking incompatibilities (pyrefly 0.34.0 vs 0.23.1) - Building these tools from source in nix is slow and adds significant time to nix-shell initialization (both are rust packages that take quite some time to build) Signed-off-by: Dyego Aurélio <dyegoaurelio@gmail.com>
d196aac to
e5c3d5a
Compare
|
This issue was because activating the virtualenv was overriding the path again. fixed it by adding the nix logic at |
Ah, nice find! |
mukilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
On NixOS, dynamically linked binaries from the Python venv (installed via uv/pip) cannot run directly because they expect standard Linux library paths that don't exist on NixOS.
This commit adds FHS wrappers that allow these binaries to run in an FHS-compatible environment at runtime, without patching them.
I considered using the nixpkgs versions of ruff and pyrefly directly, or overriding their derivations to match the versions in requirements.txt. However, decided against it because:
Testing: just improvements to the NixOS development environment, no test needed
Before:
(note that the
JSONDecodeErroris because we're trying to parse the "NixOS cannot run dynamically linked executables intended..." string as JSON)Now: