Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c3f434fd624a
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7e40287d00e3
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on May 20, 2017

  1. fish: source NixOS environment on non-login shells, when it hasn't been

    sourced
    (this fixes issue #25789:
    #25789 (comment) and
    the issue with git-annex mentioned here
    #24314 (comment) )
    Patrick Callahan committed May 20, 2017
    Copy the full SHA
    3f91e0d View commit details
  2. fish: (NixOS only) source configuration sections anew in all child sh…

    …ells
    
    this fixes issue #25800: #25800
    Patrick Callahan committed May 20, 2017
    Copy the full SHA
    42c768c View commit details

Commits on May 22, 2017

  1. Merge pull request #25835 from therealpxc/fish

    Fish: source NixOS environment on non-login shells + source shell init on NixOS even when parent shell has done so
    Mic92 authored May 22, 2017
    Copy the full SHA
    7e40287 View commit details
Showing with 19 additions and 12 deletions.
  1. +13 −11 nixos/modules/programs/fish.nix
  2. +6 −1 pkgs/shells/fish/default.nix
24 changes: 13 additions & 11 deletions nixos/modules/programs/fish.nix
Original file line number Diff line number Diff line change
@@ -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,19 +118,20 @@ 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
set -e fish_function_path[1]
${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
'';

7 changes: 6 additions & 1 deletion pkgs/shells/fish/default.nix
Original file line number Diff line number Diff line change
@@ -45,10 +45,15 @@ let
'';

fishPreInitHooks = ''
# source nixos environment if we're a login shell
# source nixos environment
# note that this is required:
# 1. For all shells, not just login shells (mosh needs this as do some other command-line utilities)
# 2. Before the shell is initialized, so that config snippets can find the commands they use on the PATH
builtin status --is-login
or test -z "$__fish_nixos_env_preinit_sourced" -a -z "$ETC_PROFILE_SOURCED" -a -z "$ETC_ZSHENV_SOURCED"
and test -f /etc/fish/nixos-env-preinit.fish
and source /etc/fish/nixos-env-preinit.fish
and set -gx __fish_nixos_env_preinit_sourced 1
test -n "$NIX_PROFILES"
and begin