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

Manual: Passing an env var to a pure nix shell with getEnv #2386

Closed
wants to merge 1 commit into from

Conversation

Profpatsch
Copy link
Member

Describe a practical use of builtins.getEnv with nix-shell
that is not directly obvious.

Rendered:
screenshot

Describe a practical use of `builtins.getEnv` with `nix-shell`
that is not directly obvious.
@grahamc
Copy link
Member

grahamc commented Aug 31, 2018

Would it be better to use nix-shell's --keep option?

(edit: oops, pure -> keep)

@edolstra
Copy link
Member

Hm, the SSH_AUTH_SOCK thing could be considered an anti-pattern so I'm not sure it should be described here. I mean, presumably you only want SSH_AUTH_SOCK to be passed to the shell, not to a build, but Nix doesn't distinguish between those cases.

@Profpatsch
Copy link
Member Author

I mean, presumably you only want SSH_AUTH_SOCK to be passed to the shell, not to a build

Yes, that’s why I added the “(exclusively)”. It beats --keep for usage of e.g. pkgs.mkShell in that the shell.nix file can contain the whole “source of truth” for developers, no complex invocation or extra wrapper script required.

@stale
Copy link

stale bot commented Feb 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 13, 2021
@stale
Copy link

stale bot commented Apr 16, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants