From 3071ea205da9ad7dd1c4094c2076d44f88ba350e Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Thu, 7 Apr 2022 19:36:34 +0200 Subject: [PATCH] starship: skip one program invocation on each shell init (#2862) The code that is being evaled without the `--print-full-init` flag is this: ```sh __main() { local major="${BASH_VERSINFO[0]}" local minor="${BASH_VERSINFO[1]}" if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then source <(/nix/store/...-starship-1.3.0/bin/starship init bash --print-full-init) else source /dev/stdin <<<"$(/nix/store/...-starship-1.3.0/bin/starship init bash --print-full-init)" fi } __main unset -f __main ``` This code checks for bash version >= 4.1 , which has been released in 2009. Since this version is widely unavailable in nixpkgs, we can skip one program invocation and directly call `starship init bash --print-full-init`. --- modules/programs/starship.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 9aac5354..58ec518a 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -100,7 +100,7 @@ in { programs.bash.initExtra = mkIf cfg.enableBashIntegration '' if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then - eval "$(${starshipCmd} init bash)" + eval "$(${starshipCmd} init bash --print-full-init)" fi '';