{ lib, config, ... }: let inherit (lib) mkIf mkDefault concatStrings; cfg = config.marleyos.programs.starship; inherit (config.marleyos.theme) colors; in { config = mkIf (cfg.enable && colors.isRosePine) { programs.starship.settings = let mkFormat = t: " [](fg:overlay)[${t}]($style)[](fg:overlay) "; langFormat = mkFormat "$symbol$version"; in { format = mkDefault (concatStrings [ "$username" "$directory" "$nix_shell" "$git_branch" "$git_status" "$fill" "$c" "$elixir" "$elm" "$golang" "$haskell" "$java" "$julia" "$nodejs" "$nim" "$rust" "$scala" "$python" "$time" "$line_break" "$character" ]); # TODO: Make the palette available from rose-pine-nix. palettes.rose-pine = if (colors.flavor == "moon") then (mkDefault { overlay = "#393552"; love = "#eb6f92"; gold = "#f6c177"; rose = "#ea9a97"; pine = "#3e8fb0"; foam = "#9ccfd8"; iris = "#c4a7e7"; }) else if (colors.flavor == "dawn") then (mkDefault { overlay = "#f2e9e1"; love = "#b4637a"; gold = "#ea9d34"; rose = "#d7827e"; pine = "#286983"; foam = "#56949f"; iris = "#907aa9"; }) else (mkDefault { overlay = "#26233a"; love = "#eb6f92"; gold = "#f6c177"; rose = "#ebbcba"; pine = "#31748f"; foam = "#9ccfd8"; iris = "#c4a7e7"; }); palette = "rose-pine"; username = { disabled = mkDefault false; format = mkDefault (mkFormat " 󰧱 $user "); show_always = mkDefault true; style_root = mkDefault "bg:overlay fg:iris"; style_user = mkDefault "bg:overlay fg:iris"; }; directory = { format = mkDefault (mkFormat " $path "); style = mkDefault "bg:overlay fg:pine"; truncation_length = mkDefault 3; truncation_symbol = mkDefault "…/"; substitutions = { Documents = mkDefault "󰈙"; Downloads = mkDefault " "; Music = mkDefault " "; Pictures = mkDefault " "; }; }; git_branch = { format = mkDefault (mkFormat " $symbol $branch "); style = mkDefault "bg:overlay fg:foam"; symbol = mkDefault ""; }; git_status = { disabled = mkDefault false; style = mkDefault "bg:overlay fg:love"; format = mkDefault (mkFormat " $all_status$ahead_behind"); up_to_date = mkDefault "[ ✓ ](bg:overlay fg:iris)"; untracked = mkDefault "[?\\($count\\)](bg:overlay fg:gold)"; stashed = mkDefault "[\\$](bg:overlay fg:iris)"; modified = mkDefault "[!\\($count\\)](bg:overlay fg:gold)"; renamed = mkDefault "[»\\($count\\)](bg:overlay fg:iris)"; deleted = mkDefault "[✘\\($count\\)](style)"; staged = mkDefault "[++\\($count\\)](bg:overlay fg:gold)"; ahead = mkDefault "[⇡\\(\${count}\\)](bg:overlay fg:foam)"; diverged = mkDefault "⇕[\\[](bg:overlay fg:iris)[⇡\\(\${ahead_count}\\)](bg:overlay fg:foam)[⇣\\(\${behind_count}\\)](bg:overlay fg:rose)[\\]](bg:overlay fg:iris)"; behind = mkDefault "[⇣\\(\${count}\\)](bg:overlay fg:rose)"; }; fill = { style = mkDefault "fg:overlay"; symbol = mkDefault " "; }; time = { disabled = mkDefault false; format = mkDefault (mkFormat " $time 󰴈 "); style = mkDefault "bg:overlay fg:rose"; time_format = mkDefault "%I:%M%P"; use_12hr = mkDefault true; }; character = let vim = ""; mkChar = sym: col: " [${sym}](fg:${col}) [󰄾](fg:foam)"; in { success_symbol = mkChar "" "iris"; error_symbol = mkChar "󰋔" "love"; vimcmd_symbol = mkChar vim "rose"; vimcmd_replace_one_symbol = mkChar vim "foam"; vimcmd_replace_symbol = mkChar vim "foam"; vimcmd_visual_symbol = mkChar vim "iris"; }; ### Languages ### c = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; elixir = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; elm = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; haskell = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; java = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; julia = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault " "; }; nodejs = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault "󰎙 "; }; nim = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault "󰆥 "; }; python = { style = mkDefault "bg:overlay fg:pine"; disabled = mkDefault false; symbol = mkDefault " "; }; rust = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = mkDefault false; symbol = mkDefault ""; }; scala = { style = "bg:overlay fg:pine"; format = mkDefault langFormat; disabled = false; symbol = " "; }; ### Tools ### conda = { style = mkDefault "bg:overlay fg:pine"; format = mkDefault (mkFormat "$symbol$environment"); disabled = mkDefault false; symbol = mkDefault "🅒 "; }; nix_shell = { style = "bg:overlay fg:foam"; format = mkDefault (mkFormat " $symbol $state( \($name\)) "); disabled = mkDefault false; symbol = mkDefault " "; }; }; }; }