diff options
Diffstat (limited to 'home-manager/modules/programs/starship.nix')
-rw-r--r-- | home-manager/modules/programs/starship.nix | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/home-manager/modules/programs/starship.nix b/home-manager/modules/programs/starship.nix index 7c7819865f7..8462d331501 100644 --- a/home-manager/modules/programs/starship.nix +++ b/home-manager/modules/programs/starship.nix @@ -31,8 +31,23 @@ in { }; settings = mkOption { - type = types.attrs; + type = with types; + let + prim = either bool (either int str); + primOrPrimAttrs = either prim (attrsOf prim); + entry = either prim (listOf primOrPrimAttrs); + entryOrAttrsOf = t: either entry (attrsOf t); + entries = entryOrAttrsOf (entryOrAttrsOf entry); + in attrsOf entries // { description = "Starship configuration"; }; default = { }; + example = literalExample '' + { + add_newline = false; + prompt_order = [ "line_break" "package" "line_break" "character" ]; + scan_timeout = 10; + character.symbol = "➜"; + } + ''; description = '' Configuration written to <filename>~/.config/starship.toml</filename>. @@ -74,7 +89,7 @@ in { mkIf (cfg.settings != { }) { source = configFile cfg.settings; }; programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - if [[ -z $INSIDE_EMACS ]]; then + if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then eval "$(${cfg.package}/bin/starship init bash)" fi ''; @@ -85,8 +100,8 @@ in { fi ''; - programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - if test -z "$INSIDE_EMACS" + programs.fish.promptInit = mkIf cfg.enableFishIntegration '' + if test "$TERM" != "dumb" -a \( -z "$INSIDE_EMACS" -o "$INSIDE_EMACS" = "vterm" \) eval (${cfg.package}/bin/starship init fish) end ''; |