-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.mod.nix
More file actions
201 lines (179 loc) · 5.63 KB
/
Copy pathshell.mod.nix
File metadata and controls
201 lines (179 loc) · 5.63 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{
nixos-cli,
gai,
...
}: {
universal.modules = [
nixos-cli.nixosModules.nixos-cli
];
personal.modules = [
(
{pkgs, ...}: {
environment.systemPackages = [
pkgs.nix-output-monitor
pkgs.fish
gai.packages.${pkgs.system}.default
pkgs.openssl
];
programs.nixos-cli = {
enable = true;
settings = {
apply.use_nom = true;
};
};
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
}
)
];
personal.home_modules = [
(
{...}: {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
j = "just";
g = "git";
l = "ls -la";
t = "tmux new-session -A -s main";
ts = "tms switch";
ff = "fastfetch";
fg = "job unfreeze";
bg = "job spawn";
fit = "nix flake init -t github:akirak/flake-templates#minimal";
fi = "nix flake init";
c = "cargo";
};
};
programs.nushell = {
enable = false;
shellAliases = {
j = "just";
g = "git";
l = "ls -la";
t = "tmux new-session -A -s main";
ts = "tms switch";
ff = "fastfetch";
fg = "job unfreeze";
bg = "job spawn";
fit = "nix flake init -t github:akirak/flake-templates#minimal";
fi = "nix flake init";
c = "cargo";
};
settings = {
show_banner = false;
buffer_editor = "nvim";
};
extraConfig = ''
let nixos_completer = {|spans|
nixos _carapace nushell ...$spans | from json
}
let carapace_completer = {|spans: list<string>|
carapace $spans.0 nushell ...$spans
| from json
| if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
}
let fish_completer = {|spans|
fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'"
| from tsv --flexible --noheaders --no-infer
| rename value description
| update value {|row|
let value = $row.value
let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value}
if ($need_quote and ($value | path exists)) {
let expanded_path = if ($value starts-with ~) {$value | path expand --no-symlink} else {$value}
$'"($expanded_path | str replace --all "\"" "\\\"")"'
} else {$value}
}
}
let completers = {|spans|
let expanded_alias = scope aliases
| where name == $spans.0
| get -o 0.expansion
let spans = if $expanded_alias != null {
$spans
| skip 1
| prepend ($expanded_alias | split row ' ' | take 1)
} else {
$spans
}
match $spans.0 {
git => $fish_completer
nixos => $nixos_completer
_ => $carapace_completer
} | do $in $spans
}
# https://www.nushell.sh/cookbook/external_completers.html
$env.config = {
completions: {
external: {
enable: true
completer: $completers
}
}
}
'';
};
programs.carapace = {
enable = true;
enableNushellIntegration = true;
};
programs.starship = {
enable = true;
settings = {
# "$schema" = "https://starship.rs/config-schema.json";
format = "$username$hostname$directory$git_branch$git_state$git_status$package$nix_shell$line_break$character";
directory = {
style = "blue";
};
character = {
success_symbol = " [➜](green)";
error_symbol = " [➜](red)";
};
git_branch = {
format = "on [$branch]($style)";
style = "purple bg:0xFCA17D";
};
git_status = {
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed )]($style)";
style = "cyan";
conflicted = "";
untracked = "";
modified = "";
staged = "";
renamed = "";
deleted = "";
stashed = "≡";
};
git_state = {
format = ''\([$state( $progress_current/$progress_total)]($style)\) '';
style = "bright-black";
};
package = {
format = "for [$version]($style) ";
style = "208";
display_private = true;
disabled = false;
version_format = "v$raw";
};
nix_shell = {
format = "in [(\($name\))]($style) ";
disabled = false;
style = "blue";
};
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = {
hide_env_diff = true;
};
};
}
)
];
}