dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/shell/prompt.nix (4969B)
1## Shell Prompt Configuration ##
2_: {
3 flake.modules.nixos.prompt = {config, ...}: {
4 programs.starship = let
5 open = "";
6 close = "";
7 char = "⮞";
8
9 build = a: b: c:
10 build' {
11 icon = a;
12 var = b;
13 color = c;
14 };
15
16 build' = {
17 icon,
18 var,
19 color,
20 style ? "fg:white",
21 end ? "[${close}](fg:base03)",
22 ...
23 }: "[─](fg:base04)[${open}](fg:${color})[${icon}](fg:base01 bg:${color})[${close}](fg:${color} bg:base03)[ ${var}](${style} bg:base03)${end}";
24 in {
25 enable = true;
26 settings = {
27 add_newline = true;
28 continuation_prompt = "${char} ";
29 format = "[╭](fg:base04)$os$directory$git_branch$git_status$fill$c$python$java$nodejs$dotnet$status$cmd_duration$shell$username$hostname$time$line_break$character";
30 character = {
31 format = "[╰─$symbol](fg:base04) ";
32 success_symbol = "[${char}](fg:bold white)";
33 error_symbol = "[${char}](fg:bold red)";
34 };
35
36 os = {
37 disabled = false;
38 format = "(fg:base04)[${open}](fg:white)[$symbol](fg:base01 bg:white)[${close}](fg:white)";
39 symbols = {
40 Android = "";
41 Arch = "";
42 Fedora = "";
43 Linux = "";
44 Macos = "";
45 NixOS = "";
46 Ubuntu = "";
47 Windows = "";
48 Unknown = "";
49 };
50 };
51
52 directory = {
53 disabled = false;
54 format = build "" "$read_only$truncation_symbol$path" "blue";
55 home_symbol = "~";
56 truncation_symbol = "…/";
57 truncation_length = 4;
58 truncate_to_repo = false;
59 read_only = "";
60 };
61
62 git_branch = {
63 disabled = false;
64 format = build' {
65 icon = "";
66 var = "$branch";
67 color = "green";
68 end = "";
69 };
70 };
71
72 git_status = {
73 disabled = false;
74 format = "[$ahead_behind$all_status](fg:green bg:base03)[${close}](fg:base03)";
75 ahead = " ⇡$count";
76 behind = " ⇣$count";
77 diverged = " ⇡$ahead_count ⇣$behind_count";
78 conflicted = " =$count";
79 deleted = " ×$count";
80 modified = " !$count";
81 renamed = " »$count";
82 staged = " +$count";
83 stashed = " *$count";
84 untracked = " ?$count";
85 up_to_date = "";
86 };
87
88 c.format = build " C" "$version" "bright-white";
89 python.format = build " Python" "$version" "bright-white";
90 java.format = build " Java" "$version" "bright-white";
91 nodejs.format = build " Node.js" "$version" "bright-white";
92 dotnet.format = build " .NET" "$version" "bright-white";
93
94 fill = {
95 symbol = "─";
96 style = "fg:base04";
97 };
98
99 status = {
100 disabled = false;
101 format = build "" "$status" "red";
102 };
103
104 cmd_duration = {
105 min_time = 500;
106 format = build "" "$duration" "orange";
107 };
108
109 shell = {
110 disabled = false;
111 format = build "" "$indicator" "purple";
112 bash_indicator = "bash";
113 fish_indicator = "fish";
114 zsh_indicator = "zsh";
115 unknown_indicator = "shell";
116 };
117
118 username = {
119 show_always = true;
120 style_user = "fg:white";
121 style_root = "bold fg:red";
122 format = build' {
123 icon = "";
124 var = "$user";
125 color = "yellow";
126 style = "$style";
127 };
128 };
129
130 hostname = {
131 disabled = false;
132 format = build "" "$hostname" "cyan";
133 ssh_only = false;
134 };
135
136 time = {
137 disabled = false;
138 format = build "" "$time" "blue";
139 time_format = "%H:%M";
140 };
141
142 palette = "base16";
143 palettes.base16 = with config.lib.stylix.colors.withHashtag; {
144 black = base00;
145 bright-black = base03;
146 white = base05;
147 bright-white = base07;
148 purple = magenta;
149 bright-purple = bright-magenta;
150 inherit
151 blue
152 brown
153 cyan
154 green
155 magenta
156 orange
157 red
158 yellow
159 bright-blue
160 bright-cyan
161 bright-green
162 bright-magenta
163 bright-red
164 bright-yellow
165 base00
166 base01
167 base02
168 base03
169 base04
170 base05
171 base06
172 base07
173 base08
174 base09
175 base0A
176 base0B
177 base0C
178 base0D
179 base0E
180 base0F
181 ;
182 };
183 };
184 };
185 };
186}