Tor Hedin Brønner d273db48c6 nixos/shells: avoid overriding the environment for child shells
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 b00a3fc6fd82834114771f2115a2b032f0ebfe29
(the original #30418).
2018-08-30 13:20:39 +00:00
..
2017-08-11 15:48:45 +00:00
2018-07-14 20:21:41 +08:00
2018-04-07 15:06:51 +02:00
2018-04-08 22:37:35 -04:00
2018-06-08 20:57:16 +02:00
2018-07-20 18:48:37 +00:00
2017-08-25 14:08:11 +02:00
2017-07-23 12:56:04 +03:00
2018-03-12 15:13:31 +11:00
2017-09-29 15:01:21 +01:00
2018-07-20 18:48:37 +00:00
2018-01-04 09:58:21 +01:00