Skip to content
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

How is PATH populated in devbox shell? #2409

Open
andbleo opened this issue Nov 14, 2024 · 2 comments
Open

How is PATH populated in devbox shell? #2409

andbleo opened this issue Nov 14, 2024 · 2 comments
Labels
bug Something isn't working triage Issue needs triage

Comments

@andbleo
Copy link

andbleo commented Nov 14, 2024

What happened?

I am trying to understand how the PATH env var is set when invoking devbox shell. Specifically, if I update PATH in my .zshrc (like when doing source "$HOME/.cargo/env", which updates the PATH), it isn't reflected in the PATH in my devbox shell. If I instead set PATH in my .profile, it is included in the PATH in my devbox shell. I was initially confused by this because my .zshrc is sourced by devbox shell (I see other env vars exported and a simple echo Testing 1 2 3 in my .zshrc is printed) so I incorrectly assumed it was updating my PATH based on the value sourced from .zshrc.

I'm fine with moving my updates to PATH from .zshrc to .profile to make this work, but it would be great to see the following:

  1. Document somewhere how PATH is set (if it isn't already)
  2. Document if there are any other env vars that get special treatment like PATH (if any)

Steps to reproduce

  1. update the PATH env var in .zshrc
  2. devbox shell
  3. echo $PATH and see that my updates to PATH from .zshrc aren't there

Command

shell

devbox.json

No response

Devbox version

0.13.6

Nix version

2.24.6

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

@andbleo andbleo added bug Something isn't working triage Issue needs triage labels Nov 14, 2024
@DerArkeN
Copy link
Contributor

hey there, i can't reproduce this. for me everything is working fine using zsh.
eg i have this in my .zshrc:

path+=('/usr/local/go/bin')
export PATH

and then in a devbox shell running echo $PATH i see the path at the very.

@andbleo
Copy link
Author

andbleo commented Nov 19, 2024

I think I have narrowed down where the issue occurs. I have the following line in my .zshrc: eval "$(devbox global shellenv --init-hook)"

If I append to PATH before that command, my changes to PATH show up when I enter a devbox shell, but they don't show up if I append to PATH after that command.

I'm not sure why that command is interfering with the PATH for non-global devbox shells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs triage
Development

No branches or pull requests

2 participants