-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli-apps.nix
338 lines (337 loc) · 9.33 KB
/
cli-apps.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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
{ config, lib, pkgs, ... }:
{
programs.kakoune = {
enable = true;
config = {
numberLines = {
enable = true;
highlightCursor = true;
relative = true;
};
showMatching = true;
showWhitespace = {
enable = true;
space = " ";
};
ui.assistant = "none";
wrapLines = {
enable = true;
indent = true;
marker = "⏎";
word = true;
};
keyMappings = [
{
key = "<a-backspace>";
mode = "normal";
effect = "<a-space>";
docstring = "clear the main selection";
}
{
key = "<space>";
mode = "user";
effect = ":peneira-files<ret>";
docstring = "open a file with a fuzzy finder";
}
{
key = "b";
mode = "user";
effect = ":enter-user-mode buffer<ret>";
docstring = "Buffer actions";
}
{
key = "s";
mode = "user";
effect = ":enter-user-mode spell<ret>";
docstring = "Spell check actions";
}
{
key = "l";
mode = "user";
effect = ":peneira-lines<ret>";
docstring = "Spell check actions";
}
{
key = "b";
mode = "buffer";
effect = ":peneira-buffers<ret>";
docstring = "fuzzy jump to a buffer";
}
{
key = "d";
mode = "buffer";
effect = ":db<ret>";
docstring = "delete the current buffer";
}
{
key = "n";
mode = "buffer";
effect = ":bn<ret>";
docstring = "move to the next buffer";
}
{
key = "p";
mode = "buffer";
effect = ":bp<ret>";
docstring = "move to the previous buffer";
}
{
key = "f";
mode = "buffer";
effect = ":format-buffer<ret>";
docstring = "auto-format the current buffer";
}
{
key = "s";
mode = "spell";
effect = ":spell<ret>";
docstring = "spell check the current buffer";
}
{
key = "n";
mode = "spell";
effect = ":spell-next<ret>";
docstring = "jump to the next spelling mistake";
}
{
key = "c";
mode = "spell";
effect = ":spell-clear<ret>";
docstring = "clear spell check highlighting";
}
];
};
plugins = [
(pkgs.kakouneUtils.buildKakounePlugin rec {
pname = "peneira";
version = "2022-02-13";
src = pkgs.fetchFromGitHub {
owner = "gustavo-hms";
repo = pname;
rev = "429f0422f4395564811d9c73d51a78b772dbd4e4";
hash = "sha256-kO1kZr8U214qJxP0txUpzUl1/nJadknXDSTEfLKlaPI=";
};
})
(pkgs.kakouneUtils.buildKakounePlugin rec {
pname = "luar";
version = "2022-02-28";
src = pkgs.fetchFromGitHub {
owner = "gustavo-hms";
repo = pname;
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
hash = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
};
})
];
extraConfig =
with (config.colors.fn "rgb:"); ''
face global value ${base09}
face global type ${base0A}+b
face global identifier ${base08}
face global string ${base0B}
face global keyword ${base0E}+b
face global operator ${base05}
face global attribute ${base0C}
face global comment ${base03}
face global meta ${base0D}
face global builtin ${base0D}+b
face global title ${base0D}+b
face global header ${base0D}+b
face global bold ${base0A}+b
face global italic ${base0E}
face global mono ${base0B}
face global block ${base0C}
face global link ${base09}
face global bullet ${base08}
face global list ${base08}
face global Default ${base05},${base00}
face global PrimarySelection ${base06},${base0D}
face global SecondarySelection ${base06},${base0F}
face global PrimaryCursor ${base00},${base05}
face global SecondaryCursor ${base06},${base0C}
face global LineNumbers ${base02},${base00}
face global LineNumberCursor ${base0A},${base00}
face global MenuForeground ${base00},${base0D}
face global MenuBackground ${base00},${base0C}
face global MenuInfo ${base02}
face global Information ${base00},${base0A}
face global Error ${base00},${base08}
face global StatusLine ${base04},${base01}
face global StatusLineMode ${base0B}
face global StatusLineInfo ${base0D}
face global StatusLineValue ${base0C}
face global StatusCursor ${base00},${base05}
face global Prompt ${base0D},${base01}
face global MatchingChar ${base06},${base02}+b
face global BufferPadding ${base03},${base00}
require-module luar
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
require-module peneira
define-command peneira-buffers %{
peneira 'buffers: ' %{ printf '%s\n' $kak_quoted_buflist } %{
buffer %arg{1}
}
}
'';
};
programs.htop.enable = true;
programs.direnv = {
enable = true;
enableFishIntegration = true;
stdlib = ''
use_flake() {
watch_file flake.nix
watch_file flake.lock
eval "$(nix print-dev-env)"
}
'';
};
programs.bash = {
enable = true;
shellAliases = {
ls = "exa";
j = "just";
c = "cargo";
sv = "systemctl --user";
psme = "pstree -h -C age -U -T $USER";
icat = "wezterm imgcat";
isvg = "rsvg-convert | icat";
idot = let inherit (config.colors.fn "#") base00 base05; in
''dot -T bmp \
-Gbgcolor="${base00}" \
-Gcolor="${base05}" \
-Ncolor="${base05}" \
-Nfontcolor="${base05}" \
-Ecolor="${base05}" \
-Efontcolor="${base05}" \
| icat
'';
};
sessionVariables.EDITOR = "edit";
sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1";
bashrcExtra = ''
export PS1=' ; \[$(tput sgr0)\]'
export PROMPT_COMMAND='if [[ $? != 0 ]] ; then echo -e -n "\001$(tput setaf 2)\002"; fi'
export LESS_TERMCAP_mb=$(tput setaf 6) # cyan
export LESS_TERMCAP_md=$(tput setaf 2) # green
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3) # yellow
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput sitm; tput setaf 5) # magenta
export LESS_TERMCAP_ue=$(tput ritm; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
'';
};
programs.git = {
package = pkgs.gitAndTools.gitFull;
enable = true;
aliases = {
ds = "diff --staged";
ap = "add -p";
};
extraConfig = {
core.editor = "edit";
pull.rebase = true;
};
ignores = [ ".direnv.d" ".envrc" "shell.nix" ];
userEmail = "[email protected]";
userName = "Jimmy Brisson";
};
programs.jq.enable = true;
programs.man.enable = true;
programs.skim = {
enable = true;
changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d";
defaultCommand = "fd --type f || git ls-tree -r --name-only HEAD || rg --files || find .";
};
services.lorri.enable = true;
systemd.user.services.ollama = {
Unit = {
Description = "LLM server";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service.ExecStart = "${pkgs.ollama}/bin/ollama serve";
Install.WantedBy = [ "graphical-session.target" ];
};
home.packages = let
edit = pkgs.writers.writeBashBin "edit" ''
if [[ $# > 0 ]]; then
files=$@
else
files=$(sk -m)
if [[ $? != 0 ]] ; then
exit 1
fi
fi
ws=$(hyprctl activeworkspace -j | jq -r ".name")
if [[ $ws != "" ]] ; then
if [[ -e $XDG_RUNTIME_DIR/kakoune/$ws ]] ; then
exec kak -c $ws $files
else
exec kak -s $ws $files
fi
else
exec kak $files
fi
'';
rgl = pkgs.writers.writeBashBin "rgl" ''
rg -p $@ | less -RF
'';
git-ip-review = pkgs.writeShellScriptBin "git-ip-review" ''
rev=$(git rev-parse --abbrev-ref HEAD)
if [ "HEAD" == $rev ] ; then
echo "Error: detached HEAD; Refusing to push an ip review"
exit 1
else
git push arm $rev:refs/for/master/$rev
fi
'';
in [
edit
rgl
git-ip-review
pkgs.aspell
pkgs.aspellDicts.en
pkgs.bashInteractive
pkgs.cargo-flamegraph
pkgs.direnv
pkgs.entr
pkgs.eza
pkgs.fd
pkgs.fre
pkgs.file
pkgs.gdb
pkgs.git-hub
pkgs.git-review
pkgs.git-series
pkgs.graphviz
pkgs.just
pkgs.libnotify
pkgs.nixpkgs-fmt
pkgs.nix-top
pkgs.ollama
pkgs.patchelf
pkgs.procs
pkgs.pv
pkgs.psmisc
pkgs.usbutils
pkgs.rink
pkgs.ripgrep
pkgs.screen
pkgs.tmux
pkgs.xe
pkgs.xdg-user-dirs
pkgs.xdotool
pkgs.xorg.xwininfo
pkgs.yad
pkgs.bc
pkgs.wget
pkgs.unzip
pkgs.p7zip
pkgs.innoextract
pkgs.steam-run
pkgs.socat
];
}