-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
The issue happens when nixpkgs-review (or any python package) is installed in the current shell via direnv. E.g., echo "use flake" > .envrc in the nixpkgs repo.
Here's what I think is happening:
- Direnv sets the
PYTHONPATHwhen it makesnixkgs-reviewavailable in the current shell. nixpkgs-review pr #SOME_PYTHON_PRsets-up a nix-shell with a differentPYTHONPATH(one that contains the python package to review).nixpkgs-reviewchanges directory to~/.cache/nixpkgs-review/...(at some point).nixpkgs-reviewopens a nix shell.- The nix shell displays a prompt which runs the direnv hook.
- The direnv hook notices that the current directory doesn't match
DIRENV_DIR, so it unloads the environment, unsettingPYTHONPATH.
It's possible to work around this by setting programs.direnv.loadInNixShell to false, but that's not the default behavior and debugging this is non-trivial.
IMO, the right way to fix this is for nixpkgs-review to clean its environment before and change to the ~/.cache directory entering the nix shell.
It would also be possible to fix this in direnv by checking if we're in a nixpkgs-review session here, but that won't help anyone using direnv via other means.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels