1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

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`.
This commit is contained in:
Daniel Nagy 2022-04-07 19:36:34 +02:00 committed by GitHub
parent e361373b5f
commit 3071ea205d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,7 +100,7 @@ in {
programs.bash.initExtra = mkIf cfg.enableBashIntegration '' programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
eval "$(${starshipCmd} init bash)" eval "$(${starshipCmd} init bash --print-full-init)"
fi fi
''; '';