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

nixos: inline set-environment for bash and zsh #30418

Merged
merged 1 commit into from Mar 8, 2018

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Oct 14, 2017

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Fits CONTRIBUTING.md.

@orivej
Copy link
Contributor

orivej commented Nov 6, 2017

What is this good for?

@lukateras
Copy link
Member

lukateras commented Nov 8, 2017

@orivej I'd guess one file less to read.

@orivej
Copy link
Contributor

orivej commented Nov 8, 2017

That does not sound impressive.

@LnL7
Copy link
Member Author

LnL7 commented Nov 8, 2017

Just for simplicity, I've seen some people on irc having trouble figuring out where environment variables like NIX_PATH come from because they where searching in /etc or /run/current-system.

Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's reasonable.

@LnL7 LnL7 merged commit db6fb86 into NixOS:master Mar 8, 2018
@LnL7 LnL7 deleted the inline-set-environment branch March 8, 2018 20:07
oxij pushed a commit to oxij/nixpkgs that referenced this pull request Aug 30, 2018
A shared exported guard `__NIXOS_SET_ENVIRONMENT_DONE` is introduced that can
be used to prevent child shells from sourcing `system.build.setEnvironment`
the second time.

This fixes e.g. `nix run derivation` when run from e.g. ZSH through the console or
ssh. Before this Bash would resource the common environment resetting the `PATH`
environment variable.

We also export `system.build.setEnvironment` to `/etc/set-environment` making it
easy to reset the common environment with `. /etc/set-environment` when
needed and to grep for environment variables in `/etc` (which was the
motivation of NixOS#30418).

This reverts changes made in b00a3fc
(the original NixOS#30418).
@oxij
Copy link
Member

oxij commented Aug 30, 2018

Follow up: #45784.

xeji pushed a commit that referenced this pull request Sep 6, 2018
A shared exported guard `__NIXOS_SET_ENVIRONMENT_DONE` is introduced that can
be used to prevent child shells from sourcing `system.build.setEnvironment`
the second time.

This fixes e.g. `nix run derivation` when run from e.g. ZSH through the console or
ssh. Before this Bash would resource the common environment resetting the `PATH`
environment variable.

We also export `system.build.setEnvironment` to `/etc/set-environment` making it
easy to reset the common environment with `. /etc/set-environment` when
needed and to grep for environment variables in `/etc` (which was the
motivation of #30418).

This reverts changes made in b00a3fc
(the original #30418).

(cherry picked from commit d273db4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants