/
starship.nix
executable file
·134 lines (131 loc) · 3.23 KB
/
starship.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
config,
pkgs,
...
}: let
lang = icon: color: {
symbol = icon;
format = "[$symbol ](${color})";
};
os = icon: fg: "[${icon} ](fg:${fg})";
pad = {
left = "";
right = "";
};
settings = {
add_newline = true;
format = builtins.concatStringsSep "" [
"$nix_shell"
"$os"
"$directory"
"$container"
"$git_branch $git_status"
"$python"
"$nodejs"
"$lua"
"$rust"
"$java"
"$c"
"$golang"
"$cmd_duration"
"$status"
"$line_break"
"[❯](bold purple)"
''''${custom.space}''
];
custom.space = {
when = ''! test $env'';
format = " ";
};
continuation_prompt = "∙ ┆ ";
line_break = {disabled = false;};
status = {
symbol = "✗";
not_found_symbol = " Not Found";
not_executable_symbol = " Can't Execute E";
sigint_symbol = " ";
signal_symbol = " ";
success_symbol = "";
format = "[$symbol](fg:red)";
map_symbol = true;
disabled = false;
};
cmd_duration = {
min_time = 1000;
format = "[$duration ](fg:yellow)";
};
nix_shell = {
disabled = false;
format = "[${pad.left}](fg:white)[ ](bg:white fg:black)[${pad.right}](fg:white) ";
};
container = {
symbol = " ";
format = "[$symbol ](yellow dimmed)";
};
directory = {
format = builtins.concatStringsSep "" [
" [${pad.left}](fg:bright-black)"
"[$path](bg:bright-black fg:white)"
"[${pad.right}](fg:bright-black)"
" [$read_only](fg:yellow)"
];
read_only = "";
truncate_to_repo = true;
truncation_length = 4;
truncation_symbol = "";
};
git_branch = {
symbol = "";
style = "";
format = "[ $symbol $branch](fg:purple)(:$remote_branch)";
};
os = {
disabled = false;
format = "$symbol";
};
os.symbols = {
Arch = os "" "bright-blue";
Alpine = os "" "bright-blue";
Debian = os "" "red)";
EndeavourOS = os "" "purple";
Fedora = os "" "blue";
NixOS = os "" "blue";
openSUSE = os "" "green";
SUSE = os "" "green";
Ubuntu = os "" "bright-purple";
Macos = os "" "white";
};
python = lang "" "yellow";
nodejs = lang "" "bright-blue";
bun = lang "" "blue";
deno = lang "" "blue";
lua = lang "" "blue";
rust = lang "" "red";
java = lang "" "red";
c = lang "" "blue";
golang = lang "" "blue";
dart = lang "" "blue";
elixir = lang "" "purple";
};
tomlFormat = pkgs.formats.toml {};
starshipCmd = "${pkgs.starship}/bin/starship";
in {
xdg.configFile."starship.toml" = {
source = tomlFormat.generate "starship-config" settings;
};
programs.bash.initExtra = ''
eval "$(${starshipCmd} init bash)"
'';
programs.zsh.initExtra = ''
eval "$(${starshipCmd} init zsh)"
'';
programs.nushell = {
extraEnv = ''
mkdir ${config.xdg.cacheHome}/starship
${starshipCmd} init nu | save -f ${config.xdg.cacheHome}/starship/init.nu
'';
extraConfig = ''
use ${config.xdg.cacheHome}/starship/init.nu
'';
};
}