diff options
author | xeji <36407913+xeji@users.noreply.github.com> | 2018-09-06 20:30:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 20:30:34 +0200 |
commit | 5fc8ebdda058ba55ad6405a98f9b540433305586 (patch) | |
tree | a135586eed30b771ac1c75e675159971b3c659cd /nixos/modules/config | |
parent | c42f0f95bb0c96bc3ae54ad80a107b643d5c5637 (diff) | |
parent | 8952375b484ecb65593be4e81fb8cc5ffde09428 (diff) | |
download | nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar.gz nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar.bz2 nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar.lz nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar.xz nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.tar.zst nixlib-5fc8ebdda058ba55ad6405a98f9b540433305586.zip |
Merge pull request #45784 from oxij/pull/44720-shell-env-edited
nixos/shells: Avoid overriding the environment for other child shells
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/shells-environment.nix | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 31adc9b82620..555db459f57a 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -163,15 +163,24 @@ in /bin/sh ''; + # For resetting environment with `. /etc/set-environment` when needed + # and discoverability (see motivation of #30418). + environment.etc."set-environment".source = config.system.build.setEnvironment; + system.build.setEnvironment = pkgs.writeText "set-environment" - '' - ${exportedEnvVars} + '' + # DO NOT EDIT -- this file has been generated automatically. + + # Prevent this file from being sourced by child shells. + export __NIXOS_SET_ENVIRONMENT_DONE=1 - ${cfg.extraInit} + ${exportedEnvVars} - # ~/bin if it exists overrides other bin directories. - export PATH="$HOME/bin:$PATH" - ''; + ${cfg.extraInit} + + # ~/bin if it exists overrides other bin directories. + export PATH="$HOME/bin:$PATH" + ''; system.activationScripts.binsh = stringAfter [ "stdio" ] '' |