From 73303410e9a536d588da107c486ec72d6ac430b2 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 17 Nov 2024 14:53:42 -0800 Subject: [PATCH] feat(starship): Use my own version of rose-pine; various tweaks --- modules/home/programs/starship/default.nix | 58 +---- modules/home/programs/starship/rose-pine.nix | 243 +++++++++++++++++++ 2 files changed, 248 insertions(+), 53 deletions(-) create mode 100644 modules/home/programs/starship/rose-pine.nix diff --git a/modules/home/programs/starship/default.nix b/modules/home/programs/starship/default.nix index 49f8ec8..56efdc3 100644 --- a/modules/home/programs/starship/default.nix +++ b/modules/home/programs/starship/default.nix @@ -7,75 +7,27 @@ let inherit (lib) mkEnableOption mkIf - mkForce - concatStrings ; - inherit (lib.marleyos) enabled; + inherit (lib.marleyos) disabled; cfg = config.marleyos.programs.starship; - inherit (config.marleyos.theme) colors; in { options.marleyos.programs.starship.enable = mkEnableOption "starship"; imports = [ ./nerd-font-symbols.nix + ./rose-pine.nix ]; config = mkIf cfg.enable { programs.starship = { enable = true; - rose-pine = mkIf colors.isRosePine enabled; + enableTransience = true; - settings = mkIf config.programs.starship.rose-pine.enable { - format = mkForce (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 " - ]); - - character = - let - vim = ""; - mkChar = sym: col: "[${sym}](fg:${col}) "; - in - { - success_symbol = mkChar "" "iris"; - error_symbol = mkChar "󰋔" "love"; - vimcmd_symbol = mkChar vim "rose"; - vimcmd_replace_one_symbol = mkChar vim "gold"; - vimcmd_replace_symbol = mkChar vim "gold"; - vimcmd_visual_symbol = mkChar vim "iris"; - }; - - nix_shell = { - format = "[](fg:overlay)[ $symbol $state( \($name\)) ]($style)[](fg:overlay) "; - style = "bg:overlay fg:foam"; - }; - - git_branch.style = mkForce "bg:overlay fg:love"; - git_status.style = mkForce "bg:overlay fg:rose"; - time.style = mkForce "bg:overlay fg:gold"; - }; + # Using my own version because I made so many fixes it wasn't worth... + rose-pine = disabled; }; }; } diff --git a/modules/home/programs/starship/rose-pine.nix b/modules/home/programs/starship/rose-pine.nix new file mode 100644 index 0000000..67309d2 --- /dev/null +++ b/modules/home/programs/starship/rose-pine.nix @@ -0,0 +1,243 @@ +{ + 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 " "; + }; + }; + }; +}