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

Pass through http proxy env vars in pure shell #3357

Merged
merged 1 commit into from Feb 19, 2020

Conversation

carlosdagos
Copy link
Member

Allow a pure nix-shell to inherit environment variables to signal some programs (such as curl) to use a proxy. This is quite common in eg corporate environments.

Issue arises for me whilst using stack, I opened a PR over there as well, but maybe here it can be solved in a more general way. Reference: commercialhaskell/stack#5171. As mentioned there, possible solutions are to add those variables to something like ~/.bashrc, which is totally fine too of course. However, maybe these vars are prevalent enough to warrant their inclusion in a pure nix shell.

@samueldr
Copy link
Member

samueldr commented Feb 14, 2020

--keep, added in #2323, might be the more general way:

       --keep name
           When a --pure shell is started, keep the listed environment
           variables.
~ $ export HI="hello there!"

~ $ nix-shell -p stdenv --pure --run 'set -eu; echo $HI'
/tmp/nix-shell-27378-0/rc: line 1: HI: unbound variable

~ 1 $ nix-shell -p stdenv --pure --run 'set -eu; echo $HI' --keep HI
hello there!

@carlosdagos
Copy link
Member Author

Hey @samueldr, thanks for your feedback. I didn't know about #2323, that one is interesting. However I think that's not what I'm after, as using the --keep flag would still require different software to support http proxy env vars, whereas this change would just by default support them.

@edolstra edolstra merged commit 2a14c28 into NixOS:master Feb 19, 2020
@carlosdagos carlosdagos deleted the pure-nix-shell-proxy-env branch February 19, 2020 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants