From cd2e2bea470f5ed58b3838a3184c76f99c9bbcf1 Mon Sep 17 00:00:00 2001 From: Ayman Boukraa Date: Tue, 3 Mar 2026 22:03:20 +0100 Subject: [PATCH] feat: zsh, starship, session vars + graphical option pattern --- home/base.nix | 1 + home/modules/starship.nix | 70 +++++++++++++++++++++++++++++++++++++++ home/modules/zsh.nix | 9 ++--- 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 home/modules/starship.nix diff --git a/home/base.nix b/home/base.nix index 071c846..b32659f 100644 --- a/home/base.nix +++ b/home/base.nix @@ -11,6 +11,7 @@ ./modules/theme.nix ./modules/zsh.nix ./modules/kitty.nix + ./modules/starship.nix ]; home.packages = with pkgs; [ diff --git a/home/modules/starship.nix b/home/modules/starship.nix new file mode 100644 index 0000000..42572ed --- /dev/null +++ b/home/modules/starship.nix @@ -0,0 +1,70 @@ +{ config, lib, ... }: + +let + c = config.theme.colors; +in +{ + programs.starship = { + enable = true; + + settings = { + format = lib.concatStrings [ + "$username" + "$hostname" + "$directory" + "$git_branch" + "$git_status" + "$nix_shell" + "$cmd_duration" + "$line_break" + "$character" + ]; + + username = { + style_user = "bold #${lib.removePrefix "#" c.green_b}"; + style_root = "bold #${lib.removePrefix "#" c.red_b}"; + format = "[$user]($style) "; + show_always = true; + }; + + hostname = { + ssh_only = false; + format = "at [($hostname)](bold #${lib.removePrefix "#" c.yellow_b}) "; + }; + + directory = { + style = "#${lib.removePrefix "#" c.blue_b}"; + truncation_length = 4; + truncate_to_repo = false; + }; + + git_branch = { + symbol = " "; + style = "#${lib.removePrefix "#" c.purple_b}"; + format = "[$symbol$branch]($style) "; + }; + + git_status = { + style = "#${lib.removePrefix "#" c.red_b}"; + format = "[$all_status$ahead_behind]($style) "; + }; + + nix_shell = { + symbol = " "; + style = "#${lib.removePrefix "#" c.aqua_b}"; + format = "[$symbol$state]($style) "; + }; + + cmd_duration = { + min_time = 2000; + style = "#${lib.removePrefix "#" c.yellow}"; + format = "took [$duration]($style) "; + }; + + character = { + success_symbol = "[»](bold #${lib.removePrefix "#" c.green_b})"; + error_symbol = "[»](bold #${lib.removePrefix "#" c.red_b})"; + }; + }; + }; +} diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix index 38d74fe..c9b6473 100644 --- a/home/modules/zsh.nix +++ b/home/modules/zsh.nix @@ -7,7 +7,8 @@ in # Tells HM to set ZDOTDIR, which moves all zsh config into ~/.config/zsh programs.zsh = { enable = true; - dotDir = ".config/zsh"; # sets ZDOTDIR automatically + dotDir = "${config.xdg.configHome}/zsh"; + enableCompletion = true; autosuggestion.enable = true; @@ -20,9 +21,9 @@ in share = true; }; - initContent = '' - PROMPT="%F{${c.green_b}}%n@%m%f %F{${c.yellow_b}}%~%f %F{${c.fg4}}»%f " - ''; + # initContent = '' + # PROMPT="%F{${c.green_b}}%n@%m%f %F{${c.yellow_b}}%~%f %F{${c.fg4}}»%f " + # ''; shellAliases = { ls = "eza --icons";