From 3b73bef9ee3c6415d9cd8904ab2896c317935940 Mon Sep 17 00:00:00 2001 From: ediblerope Date: Wed, 8 Apr 2026 13:42:57 +0100 Subject: [PATCH] Replace hand-rolled fish prompt with Starship powerline prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starship handles the powerline segments with proper rounded transitions between colored backgrounds. Layout: [ hostname ~/path branch] ❯ - Cyan NixOS icon, yellow hostname, green path, purple git branch - Dark text on colored backgrounds with powerline arrow transitions - Nix-shell indicator, red ❯ on error Co-Authored-By: Claude Opus 4.6 --- apps/fastfetch.nix | 105 ++++++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/apps/fastfetch.nix b/apps/fastfetch.nix index a51134c..8216fc0 100644 --- a/apps/fastfetch.nix +++ b/apps/fastfetch.nix @@ -46,47 +46,74 @@ } ''; - # Fish prompt and terminal startup + # Starship cross-shell prompt + programs.starship = { + enable = true; + settings = { + "$schema" = "https://starship.rs/config-schema.json"; + format = builtins.concatStringsSep "" [ + "[](#7dcfff)" + "$os" + "[](bg:#e0af68 fg:#7dcfff)" + "$hostname" + "[](bg:#9ece6a fg:#e0af68)" + "$directory" + "[](fg:#9ece6a bg:#bb9af7)" + "$git_branch" + "$git_status" + "[](fg:#bb9af7)" + "$nix_shell" + "\n" + "$character" + ]; + + os = { + style = "bg:#7dcfff fg:#1a1b26"; + format = "[ $symbol]($style)"; + disabled = false; + symbols.NixOS = ""; + }; + + hostname = { + ssh_only = false; + style = "bg:#e0af68 fg:#1a1b26"; + format = "[ $hostname ]($style)"; + }; + + directory = { + style = "bg:#9ece6a fg:#1a1b26"; + format = "[ $path ]($style)"; + truncation_length = 4; + truncation_symbol = ".../"; + }; + + git_branch = { + symbol = ""; + style = "bg:#bb9af7 fg:#1a1b26"; + format = "[ $symbol $branch ]($style)"; + }; + + git_status = { + style = "bg:#bb9af7 fg:#1a1b26"; + format = "[$all_status$ahead_behind ]($style)"; + }; + + nix_shell = { + symbol = " "; + style = "bold yellow"; + format = " [$symbol$state]($style)"; + }; + + character = { + success_symbol = "[❯](bold purple)"; + error_symbol = "[❯](bold red)"; + }; + }; + }; + + # Fish shell settings programs.fish.interactiveShellInit = '' # Disable default greeting set -g fish_greeting - - # Custom prompt - function fish_prompt - set -l last_status $status - - # Nix-shell indicator - if set -q IN_NIX_SHELL - set_color -o yellow - printf '[nix-shell] ' - set_color normal - end - - # Line 1: hostname ~/path - set_color -o cyan - printf ' ' - set_color -o yellow - printf ' %s' (hostname) - set_color normal - printf ' ' - set_color -o green - set -l realhome (string escape --style=regex -- $HOME) - set -l path (string replace -r "^$realhome" '~' $PWD) - printf '%s' $path - set_color normal - printf '\n' - - # Line 2: ❯ - if test $last_status -ne 0 - set_color red - else - set_color magenta - end - printf '❯ ' - set_color normal - end - - # Disable the default right prompt - function fish_right_prompt; end ''; }