From 9b04ff5e3be0ff25256bafce5d95b40313f882eb Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Thu, 29 Jul 2021 19:37:16 +0800 Subject: [PATCH] fish: remove superfluous config guard --- modules/programs/fish.nix | 40 +++++++++------------------------------ 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index f349841d7..8475fbb9e 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -340,41 +340,24 @@ in { # ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated # automatically by home-manager. - # if we haven't sourced the general config, do it - if not set -q __fish_general_config_sourced + # Only execute this file once per shell. + set -q __fish_home_manager_config_sourced; and exit + set -g __fish_home_manager_config_sourced 1 - set --prepend fish_function_path ${ - if pkgs ? fishPlugins && pkgs.fishPlugins ? foreign-env then - "${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d" - else - "${pkgs.fish-foreign-env}/share/fish-foreign-env/functions" - } - fenv source ${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh > /dev/null - set -e fish_function_path[1] + set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d + fenv source ${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh > /dev/null + set -e fish_function_path[1] - ${cfg.shellInit} - # 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_general_config_sourced 1 + ${cfg.shellInit} - end - - # if we haven't sourced the login config, do it - status --is-login; and not set -q __fish_login_config_sourced - and begin + status --is-login; and begin # Login shell initialisation ${cfg.loginShellInit} - # 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_login_config_sourced 1 - end - # if we haven't sourced the interactive config, do it - status --is-interactive; and not set -q __fish_interactive_config_sourced - and begin + status --is-interactive; and begin # Abbreviations ${abbrsStr} @@ -388,11 +371,6 @@ in { # Interactive shell intialisation ${cfg.interactiveShellInit} - # 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_interactive_config_sourced 1 - end ''; }