-
Notifications
You must be signed in to change notification settings - Fork 1
/
starship.nix
95 lines (89 loc) · 2.48 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
{
delib,
lib,
pkgs,
homeconfig,
...
}:
delib.module {
name = "programs.starship";
options = delib.singleEnableOption true;
nixos.ifEnabled = {
programs = {
bash.promptInit = ''
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG="${homeconfig.xdg.configHome}/starship.toml"
fi
eval "$(${lib.getExe pkgs.starship} init bash)"
'';
fish.promptInit = ''
if not test -f "$HOME/.config/starship.toml";
set -x STARSHIP_CONFIG "${homeconfig.xdg.configHome}/starship.toml"
end
eval "$(${lib.getExe pkgs.starship} init fish)"
'';
zsh.promptInit = ''
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG="${homeconfig.xdg.configHome}/starship.toml"
fi
eval "$(${lib.getExe pkgs.starship} init zsh)"
'';
};
};
home.ifEnabled.programs.starship = {
enable = true;
settings = {
format = lib.concatStrings ["$username" "$hostname" "$battery" "$nix_shell" "$directory" "$git_branch" "$cmd_duration" "$character"];
add_newline = true;
scan_timeout = 10;
character = {
success_symbol = "[❯](bold dimmed green)";
error_symbol = "[❯](bold dimmed red)";
};
username = {
style_user = "bold dimmed green";
style_root = "bold dimmed red";
format = "[$user]($style) at ";
};
directory = {
format = "in [$path]($style)[$read_only]($read_only_style) ";
style = "bold dimmed green";
read_only = "*";
read_only_style = "dimmed red";
};
git_branch = {
style = "bold dimmed green";
format = "on [$branch]($style) ";
ignore_branches = ["master" "main"];
};
cmd_duration = {
min_time = 1000;
style = "bold dimmed green";
format = "took [$duration]($style) ";
};
hostname = {
ssh_only = false;
ssh_symbol = "*";
format = "[$hostname$ssh_symbol]($style) ";
style = "bold dimmed green";
};
battery = {
format = "with [$percentage]($style) ";
display = [
{
threshold = 100;
style = "bold dimmed green";
}
{
threshold = 30;
style = "bold dimmed red";
}
];
};
nix_shell = {
style = "bold purple";
format = "via [$state( \($name\))]($style) ";
};
};
};
}