summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorPatrick Callahan <pxcallahan@gmail.com>2017-05-16 12:21:41 -0700
committerPatrick Callahan <pxcallahan@gmail.com>2017-05-19 21:00:24 -0700
commit42c768c8e8ed393c392bb635fd963ff5c2e72698 (patch)
tree5ba18e6e6e501fc063d60c63f6de785e522dda44 /nixos/modules/programs
parent3f91e0dbae6ce0d37166084f4b8b93c46fe08ad2 (diff)
downloadnixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar.gz
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar.bz2
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar.lz
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar.xz
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.tar.zst
nixlib-42c768c8e8ed393c392bb635fd963ff5c2e72698.zip
fish: (NixOS only) source configuration sections anew in all child shells
this fixes issue #25800: https://github.com/NixOS/nixpkgs/issues/25800
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/fish.nix24
1 files changed, 13 insertions, 11 deletions
diff --git a/nixos/modules/programs/fish.nix b/nixos/modules/programs/fish.nix
index eb969ee1ce0c..c8d94a47be28 100644
--- a/nixos/modules/programs/fish.nix
+++ b/nixos/modules/programs/fish.nix
@@ -104,8 +104,6 @@ in
     environment.etc."fish/foreign-env/interactiveShellInit".text = cfge.interactiveShellInit;
 
     environment.etc."fish/nixos-env-preinit.fish".text = ''
-      # avoid clobbering the environment if it's been set by a parent shell
-
       # This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently
       # unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish
       set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $__fish_datadir/functions
@@ -120,7 +118,7 @@ in
     environment.etc."fish/config.fish".text = ''
       # /etc/fish/config.fish: DO NOT EDIT -- this file has been generated automatically.
 
-      # if our parent shell didn't source the general config, do it
+      # if we haven't sourced the general config, do it
       if not set -q __fish_nixos_general_config_sourced
         set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path
         fenv source /etc/fish/foreign-env/shellInit > /dev/null
@@ -128,11 +126,12 @@ in
         
         ${cfg.shellInit}
 
-        # and leave a note to our children to spare them the same work
-        set -gx __fish_nixos_general_config_sourced 1
+        # and leave a note so we don't source this config section again from
+        # this very shell (children will source the general config anew)
+        set -g __fish_nixos_general_config_sourced 1
       end
 
-      # if our parent shell didn't source the login config, do it
+      # if we haven't sourced the login config, do it
       status --is-login; and not set -q __fish_nixos_login_config_sourced
       and begin
         set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path
@@ -141,11 +140,12 @@ in
         
         ${cfg.loginShellInit}
 
-        # and leave a note to our children to spare them the same work
-        set -gx __fish_nixos_login_config_sourced 1
+        # and leave a note so we don't source this config section again from
+        # this very shell (children will source the general config anew)
+        set -g __fish_nixos_login_config_sourced 1
       end
 
-      # if our parent shell didn't source the interactive config, do it
+      # if we haven't sourced the interactive config, do it
       status --is-interactive; and not set -q __fish_nixos_interactive_config_sourced
       and begin
         ${fishAliases}
@@ -158,8 +158,10 @@ in
         ${cfg.promptInit}
         ${cfg.interactiveShellInit}
 
-        # and leave a note to our children to spare them the same work
-        set -gx __fish_nixos_interactive_config_sourced 1
+        # and leave a note so we don't source this config section again from
+        # this very shell (children will source the general config anew,
+        # allowing configuration changes in, e.g, aliases, to propagate)
+        set -g __fish_nixos_interactive_config_sourced 1
       end
     '';