From 5ed3ac97545fff518d7f50d516737c150a1ed954 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 16 Nov 2024 20:45:03 -0800 Subject: [PATCH] feat(home): Starship --- homes/x86_64-linux/marley@nyx/default.nix | 1 + modules/home/programs/starship/default.nix | 82 +++++++++++ .../programs/starship/nerd-font-symbols.nix | 103 ++++++++++++++ old/home/programs/starship.nix | 128 ------------------ 4 files changed, 186 insertions(+), 128 deletions(-) create mode 100644 modules/home/programs/starship/default.nix create mode 100644 modules/home/programs/starship/nerd-font-symbols.nix delete mode 100644 old/home/programs/starship.nix diff --git a/homes/x86_64-linux/marley@nyx/default.nix b/homes/x86_64-linux/marley@nyx/default.nix index 901e005..1c7192f 100644 --- a/homes/x86_64-linux/marley@nyx/default.nix +++ b/homes/x86_64-linux/marley@nyx/default.nix @@ -39,6 +39,7 @@ in rbw = enabled; ripgrep = enabled; ssh = enabled; + starship = enabled; systemctl = enabled; }; xorg = { diff --git a/modules/home/programs/starship/default.nix b/modules/home/programs/starship/default.nix new file mode 100644 index 0000000..9489b71 --- /dev/null +++ b/modules/home/programs/starship/default.nix @@ -0,0 +1,82 @@ +{ + lib, + config, + namespace, + ... +}: +let + inherit (lib) + mkIf + enabled + mkForce + concatStrings + ; + inherit (lib.${namespace}) mkEnableModule; + + cfg = config.${namespace}.programs.starship; + inherit (config.${namespace}) theme; +in +{ + options = mkEnableModule "programs.starship"; + + imports = [ + ./nerd-font-symbols.nix + ]; + + config = mkIf cfg.enable { + programs.starship = { + enable = true; + + "${theme.colors.base}" = enabled; + + settings = mkIf config.programs.starship.rose-pine.enabled { + 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"; + }; + }; + }; +} diff --git a/modules/home/programs/starship/nerd-font-symbols.nix b/modules/home/programs/starship/nerd-font-symbols.nix new file mode 100644 index 0000000..5f0b0e3 --- /dev/null +++ b/modules/home/programs/starship/nerd-font-symbols.nix @@ -0,0 +1,103 @@ +{ + lib, + config, + namespace, + ... +}: +let + inherit (lib) mkIf mkForce; + + cfg = config.${namespace}.programs.starship; +in +{ + config = mkIf cfg.enable { + programs.starship.settings = { + aws.symbol = mkForce " "; + buf.symbol = mkForce " "; + c.symbol = mkForce " "; + conda.symbol = mkForce " "; + crystal.symbol = mkForce " "; + dart.symbol = mkForce " "; + directory.read_only = mkForce " 󰌾"; + docker_context.symbol = mkForce " "; + elixir.symbol = mkForce " "; + elm.symbol = mkForce " "; + fennel.symbol = mkForce " "; + fossil_branch.symbol = mkForce " "; + git_branch.symbol = mkForce " "; + git_commit.tag_symbol = mkForce "  "; + golang.symbol = mkForce " "; + guix_shell.symbol = mkForce " "; + haskell.symbol = mkForce " "; + haxe.symbol = mkForce " "; + hg_branch.symbol = mkForce " "; + hostname.ssh_symbol = mkForce " "; + java.symbol = mkForce " "; + julia.symbol = mkForce " "; + kotlin.symbol = mkForce " "; + lua.symbol = mkForce " "; + memory_usage.symbol = mkForce "󰍛 "; + meson.symbol = mkForce "󰔷 "; + nim.symbol = mkForce "󰆥 "; + nix_shell.symbol = mkForce " "; + nodejs.symbol = mkForce " "; + ocaml.symbol = mkForce " "; + os.symbols = { + Alpine = mkForce " "; + AlmaLinux = mkForce " "; + Amazon = mkForce " "; + Android = mkForce " "; + Arch = mkForce " "; + Artix = mkForce " "; + CentOS = mkForce " "; + Debian = mkForce " "; + DragonFly = mkForce " "; + Emscripten = mkForce " "; + EndeavourOS = mkForce " "; + Fedora = mkForce " "; + FreeBSD = mkForce " "; + Garuda = mkForce "󰛓 "; + Gentoo = mkForce " "; + HardenedBSD = mkForce "󰞌 "; + Illumos = mkForce "󰈸 "; + Kali = mkForce " "; + Linux = mkForce " "; + Mabox = mkForce " "; + Macos = mkForce " "; + Manjaro = mkForce " "; + Mariner = mkForce " "; + MidnightBSD = mkForce " "; + Mint = mkForce " "; + NetBSD = mkForce " "; + NixOS = mkForce " "; + OpenBSD = mkForce "󰈺 "; + openSUSE = mkForce " "; + OracleLinux = mkForce "󰌷 "; + Pop = mkForce " "; + Raspbian = mkForce " "; + Redhat = mkForce " "; + RedHatEnterprise = mkForce " "; + RockyLinux = mkForce " "; + Redox = mkForce "󰀘 "; + Solus = mkForce "󰠳 "; + SUSE = mkForce " "; + Ubuntu = mkForce " "; + Unknown = mkForce " "; + Void = mkForce " "; + Windows = mkForce "󰍲 "; + }; + package.symbol = mkForce "󰏗 "; + perl.symbol = mkForce " "; + php.symbol = mkForce " "; + pijul_channel.symbol = mkForce " "; + python.symbol = mkForce " "; + rlang.symbol = mkForce "󰟔 "; + ruby.symbol = mkForce " "; + rust.symbol = mkForce "󱘗 "; + scala.symbol = mkForce " "; + swift.symbol = mkForce " "; + zig.symbol = mkForce " "; + gradle.symbol = mkForce " "; + }; + }; +} diff --git a/old/home/programs/starship.nix b/old/home/programs/starship.nix deleted file mode 100644 index 80ed7cc..0000000 --- a/old/home/programs/starship.nix +++ /dev/null @@ -1,128 +0,0 @@ -{ lib, ... }: -{ - programs.starship = { - enable = true; - - rose-pine.enable = true; - - settings = lib.mkMerge [ - # Nerd Font Symbols - { - aws.symbol = lib.mkForce " "; - buf.symbol = lib.mkForce " "; - c.symbol = lib.mkForce " "; - conda.symbol = lib.mkForce " "; - crystal.symbol = lib.mkForce " "; - dart.symbol = lib.mkForce " "; - directory.read_only = lib.mkForce " 󰌾"; - docker_context.symbol = lib.mkForce " "; - elixir.symbol = lib.mkForce " "; - elm.symbol = lib.mkForce " "; - fennel.symbol = lib.mkForce " "; - fossil_branch.symbol = lib.mkForce " "; - git_branch.symbol = lib.mkForce " "; - git_commit.tag_symbol = lib.mkForce "  "; - golang.symbol = lib.mkForce " "; - guix_shell.symbol = lib.mkForce " "; - haskell.symbol = lib.mkForce " "; - haxe.symbol = lib.mkForce " "; - hg_branch.symbol = lib.mkForce " "; - hostname.ssh_symbol = lib.mkForce " "; - java.symbol = lib.mkForce " "; - julia.symbol = lib.mkForce " "; - kotlin.symbol = lib.mkForce " "; - lua.symbol = lib.mkForce " "; - memory_usage.symbol = lib.mkForce "󰍛 "; - meson.symbol = lib.mkForce "󰔷 "; - nim.symbol = lib.mkForce "󰆥 "; - nix_shell.symbol = lib.mkForce " "; - nodejs.symbol = lib.mkForce " "; - ocaml.symbol = lib.mkForce " "; - os.symbols = { - Alpine = lib.mkForce " "; - AlmaLinux = lib.mkForce " "; - Amazon = lib.mkForce " "; - Android = lib.mkForce " "; - Arch = lib.mkForce " "; - Artix = lib.mkForce " "; - CentOS = lib.mkForce " "; - Debian = lib.mkForce " "; - DragonFly = lib.mkForce " "; - Emscripten = lib.mkForce " "; - EndeavourOS = lib.mkForce " "; - Fedora = lib.mkForce " "; - FreeBSD = lib.mkForce " "; - Garuda = lib.mkForce "󰛓 "; - Gentoo = lib.mkForce " "; - HardenedBSD = lib.mkForce "󰞌 "; - Illumos = lib.mkForce "󰈸 "; - Kali = lib.mkForce " "; - Linux = lib.mkForce " "; - Mabox = lib.mkForce " "; - Macos = lib.mkForce " "; - Manjaro = lib.mkForce " "; - Mariner = lib.mkForce " "; - MidnightBSD = lib.mkForce " "; - Mint = lib.mkForce " "; - NetBSD = lib.mkForce " "; - NixOS = lib.mkForce " "; - OpenBSD = lib.mkForce "󰈺 "; - openSUSE = lib.mkForce " "; - OracleLinux = lib.mkForce "󰌷 "; - Pop = lib.mkForce " "; - Raspbian = lib.mkForce " "; - Redhat = lib.mkForce " "; - RedHatEnterprise = lib.mkForce " "; - RockyLinux = lib.mkForce " "; - Redox = lib.mkForce "󰀘 "; - Solus = lib.mkForce "󰠳 "; - SUSE = lib.mkForce " "; - Ubuntu = lib.mkForce " "; - Unknown = lib.mkForce " "; - Void = lib.mkForce " "; - Windows = "󰍲 "; - }; - package.symbol = lib.mkForce "󰏗 "; - perl.symbol = lib.mkForce " "; - php.symbol = lib.mkForce " "; - pijul_channel.symbol = lib.mkForce " "; - python.symbol = lib.mkForce " "; - rlang.symbol = lib.mkForce "󰟔 "; - ruby.symbol = lib.mkForce " "; - rust.symbol = lib.mkForce "󱘗 "; - scala.symbol = lib.mkForce " "; - swift.symbol = lib.mkForce " "; - zig.symbol = lib.mkForce " "; - gradle.symbol = lib.mkForce " "; - } - - { - format = lib.mkForce ( - lib.concatStrings [ - "$username " - "$directory " - "$direnv " - "$git_branch " - "$git_status " - "$fill " - "$c " - "$elixir " - "$elm " - "$golang " - "$haskell " - "$java " - "$julia " - "$nodejs " - "$nim " - "$rust " - "$scala " - "$python " - "$time " - "$line_break " - "[󱞪](fg:iris) " - ] - ); - } - ]; - }; -}