-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.nix
1794 lines (1787 loc) · 56 KB
/
home.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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
config,
lib,
pkgs,
...
}:
let
# A wrapper function for nix OpenGL application
# Big thanks from https://github.com/nix-community/nixGL/issues/44
nixgl = import <nixgl> { };
nixglWrap =
pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo "exec ${lib.getExe' nixgl.auto.nixGLDefault "nixGL"} $bin \"\$@\"" > $wrapped_bin
chmod +x $wrapped_bin
done
'';
# Vim plugins
# Some Vim plugins is not available in nixpkgs
myVimPlugin =
repo: rev:
pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = "HEAD";
src = builtins.fetchGit {
url = "https://github.com/${repo}.git";
rev = rev;
};
};
# Angular CLI
# https://www.npmjs.com/package/@angular/cli
angularCli = pkgs.stdenv.mkDerivation rec {
pname = "static-angular-cli";
version = "19.1.5";
src = builtins.fetchGit {
url = "https://github.com/ryhkml/static-angular-cli.git";
rev = "c59bb1b334e2467dc920d4d3b387e914846aa1b1";
};
buildPhase = ''
mkdir -p $out/bin
ln -s ${src}/node_modules/@angular/cli/bin/ng.js $out/bin/ng
chmod +x $out/bin/ng
'';
installPhase = ''
mkdir -p $out/lib/node_modules
cp -r ${src}/node_modules $out/lib/
'';
};
# https://www.npmjs.com/package/@angular/language-server
angularLanguageServer = builtins.fetchGit {
url = "https://github.com/ryhkml/static-angular-language-server.git";
rev = "08ae89313d07a5b9b017a132ae7db7c9e3410d9b";
};
# Bun only for x86_64-linux
# https://github.com/oven-sh/bun/releases
bunBin = pkgs.stdenv.mkDerivation rec {
pname = "bun";
version = "1.2.2";
src = pkgs.fetchurl {
url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-x64.zip";
sha256 = "0yahbz4bg68yays0q0vxa8sis7ank3462in0k0mar10zzn5gnkiz";
};
nativeBuildInputs = [ pkgs.unzip ];
phases = [
"unpackPhase"
"installPhase"
];
unpackPhase = ''
mkdir $out
unzip $src -d $out
'';
installPhase = ''
mkdir -p $out/bin
mv $out/bun-linux-x64/bun $out/bin/bun
chmod +x $out/bin/bun
ln -s $out/bin/bun $out/bin/bunx
'';
};
# Firebase CLI only for linux
# https://github.com/firebase/firebase-tools/releases
firebaseToolsCli = pkgs.stdenv.mkDerivation rec {
pname = "firebase-tools";
version = "13.29.2";
src = pkgs.fetchurl {
url = "https://github.com/firebase/firebase-tools/releases/download/v${version}/firebase-tools-linux";
sha256 = "16pjqx9y6xnb1wlklh23ksbkv30pkxjrisaw5i8wikr7ladi3jb2";
};
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/firebase
chmod +x $out/bin/firebase
'';
};
# Google Cloud CLI only for x86_64-linux
# https://console.cloud.google.com/storage/browser/cloud-sdk-release
gcloudCli = pkgs.stdenv.mkDerivation rec {
pname = "google-cloud-sdk";
version = "508.0.0";
src = pkgs.fetchurl {
url = "https://storage.googleapis.com/cloud-sdk-release/google-cloud-sdk-${version}-linux-x86_64.tar.gz";
sha256 = "14q3zdvfc01lxmpa8l358jbsb4d8i2k0cb9x7wgwv7xfcfry8ck3";
};
nativeBuildInputs = [ pkgs.gnutar ];
installPhase = ''
mkdir -p $out
mkdir -p $out/share/doc
tar -xzf $src --strip-components=1 -C $out
# Prevent collision between 2 LICENSE
mv $out/LICENSE $out/share/doc/LICENSE-google-cloud-sdk
'';
};
# LM Studio AI for Linux
# https://lmstudio.ai
lmStudio = pkgs.stdenv.mkDerivation rec {
pname = "lmstudio";
version = "0.3.9";
src = pkgs.fetchurl {
url = "https://installers.lmstudio.ai/linux/x64/${version}-6/LM-Studio-${version}-6-x64.AppImage";
sha256 = "06z67x7ranr3lggavag3diyhi1p9zcwvmgrz9xlvwl53mhr1hz1g";
};
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/LM-Studio.AppImage
chmod +x $out/bin/LM-Studio.AppImage
'';
};
# Nodejs only for x86_64-linux
# https://nodejs.org/en/download/prebuilt-binaries
nodejsBin = pkgs.stdenv.mkDerivation rec {
pname = "nodejs";
version = "22.13.1";
src = pkgs.fetchurl {
url = "https://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.xz";
sha256 = "0frvfccz1cssjcrmiff14qazwiil6wzws2c3biavbskx7krmlahd";
};
nativeBuildInputs = [ pkgs.gnutar ];
installPhase = ''
mkdir -p $out
mkdir -p $out/share/doc
tar -xJf $src --strip-components=1 -C $out
# Prevent collision between 2 LICENSE
mv $out/LICENSE $out/share/doc/LICENSE-nodejs
'';
};
# Rofi
rofiTheme = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/davatorium/rofi/refs/heads/next/themes/Arc-Dark.rasi";
sha256 = "1kqv5hbdq9w8sf0fx96knfhmzb8avh6yzp28jaizh77hpsmgdx9s";
};
# Yazi
yaziPlugins = builtins.fetchGit {
url = "https://github.com/yazi-rs/plugins.git";
rev = "e4aaf430ad7f81d2e358e3a60525c8ef3fa259fc";
};
# Zellij
zellijCompactLayout = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/zellij-org/zellij/refs/heads/main/zellij-utils/assets/layouts/compact.swap.kdl";
sha256 = "1fcva0y4ppwzi0g3g7jaik9n5f8jz120w054wfssj5fcal6l162d";
};
pathHome = builtins.getEnv "HOME";
in
{
nixpkgs.config.allowUnfree = true;
home = {
username = "ryhkml";
homeDirectory = "/home/ryhkml";
stateVersion = "24.05";
packages = with pkgs; [
# # A
act
angularCli
asciiquarium-transparent
# # C
cmus
(curl.override {
c-aresSupport = true;
gsaslSupport = true;
})
# # D
duf
# # E
exiftool
# # F
file
firebaseToolsCli
# # G
gnuplot
gcloudCli
# # H
hey
hyperfine
# # I
id3v2
# # L
lazydocker
lua
# # N
nix-prefetch-git
nodejsBin
noisetorch # This package is mind blowing!
# # P
podman-compose
# # R
R
rPackages.languageserver
rustup
# # S
sqlite
# # T
tokei
trash-cli
typescript
# # U
ueberzugpp
# # Y
yt-dlp
# # Z
zig
];
file = {
".angular-config.json".text = builtins.toJSON {
"$schema" = "${angularCli}/lib/node_modules/@angular/cli/lib/config/schema.json";
version = 1;
cli = {
completion.prompted = true;
analytics = false;
};
projects = { };
};
".bunfig.toml".text = ''
mosl = true
telemetry = false
[install.cache]
disable = true
'';
".clang-format".text = ''
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120
'';
".config/dunst/dunstrc".text = ''
[global]
font = FiraCode Nerd Font 13
width = (300, 600)
offset = 0x0
separator_height = 0
frame_width = 0
sort = update
[urgency_low]
background = "#ffffff"
foreground = "#000000"
[urgency_normal]
background = "#526596"
[urgency_critical]
background = "#ff4d4f"
[ignore]
appname=spotify
skip_display = true
[skip-display]
appname=spotify
skip_display = yes
'';
".config/foot/foot.ini".text = ''
font=FiraCode Nerd Font:size=14
initial-window-mode=maximized
[cursor]
style=beam
blink=yes
[colors]
background=000000
foreground=ffffff
[scrollback]
lines=9999
'';
".config/lazydocker/config.yml".text = ''
gui:
border: "single"
language: "en"
logs:
timestamps: true
since: ""
'';
".config/rofi/config.rasi".text = ''
configuration {
modes: "drun";
combi-modes: [drun];
font: "FiraCode Nerd Font 14";
}
${builtins.readFile rofiTheme}
'';
".config/zellij/config.kdl".text = ''
ui {
pane_frames {
rounded_corners false
}
}
keybinds {
unbind "Ctrl b" "Ctrl o" "Ctrl q"
normal {
bind "Ctrl a" { SwitchToMode "Tmux"; }
}
}
themes {
default {
fg "#ffffff"
bg "#000000"
black "#000000"
red "#ff4d4f"
green "#526596"
blue "#096dd9"
yellow "#faad14"
magenta "#965252"
cyan "#08979c"
white "#ffffff"
orange "#965287"
}
}
default_shell "${config.home.profileDirectory}/bin/fish"
layout_dir "${pathHome}/.config/zellij/layouts"
'';
".config/zellij/layouts/default.kdl".text = ''
layout {
cwd "${pathHome}"
tab name="Sysinfo" hide_floating_panes=true {
pane command="btop" name="Monitor resource" {
start_suspended true
}
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
}
tab name="Editor" hide_floating_panes=true focus=true {
pane
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
}
new_tab_template {
pane
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
}
${builtins.replaceStrings [ "compact-bar" ] [ "zellij:tab-bar" ] (builtins.readFile zellijCompactLayout)}
}
'';
".scripts/waybar/custom-clock.sh".text = ''
set -e
current_date=$(date +'%A - %B %-d, %Y')
current_time=$(date +'%-l:%M:%S')
echo -n "{\"text\": \"$current_time\", \"tooltip\": \"$current_date\"}"
'';
".scripts/rofi/power.sh".text = ''
set -e
options="Logout\nSuspend\nReboot\nPower Off"
menu=$(echo -e "$options" | rofi -dmenu -no-custom -i -p "Select Action")
case "$menu" in
"Logout")
swaymsg exit
;;
"Suspend")
systemctl suspend
;;
"Reboot")
systemctl reboot
;;
"Power Off")
systemctl poweroff
;;
"*")
echo -n
;;
esac
'';
};
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERMINAL = "alacritty";
};
};
xdg.desktopEntries.lmstudio = {
name = "LM Studio";
comment = "Discover, download, and run local LLMs";
exec = "${lmStudio}/bin/LM-Studio.AppImage";
type = "Application";
categories = [
"Utility"
"Development"
];
terminal = false;
};
editorconfig = {
enable = true;
settings = {
"*" = {
charset = "utf-8";
end_of_line = "lf";
indent_style = "tab";
indent_size = 4;
trim_trailing_whitespace = true;
insert_final_newline = true;
};
"*.nix" = {
indent_style = "space";
indent_size = 2;
};
"*.yaml" = {
indent_style = "space";
indent_size = 2;
};
"*.yml" = {
indent_style = "space";
indent_size = 2;
};
};
};
programs.home-manager.enable = true;
programs.fish = {
enable = true;
plugins = with pkgs; [
{
name = "autopair";
src = fishPlugins.autopair.src;
}
];
shellAbbrs = {
"/" = "cd /";
".." = "cd ..";
c = "clear";
C = "clear";
q = "exit";
Q = "exit";
# Act
acts = "act --no-cache-server --rm";
# Update library
cmusup = "cmus-remote -C clear; cmus-remote -C \"add ~/Music\"; cmus-remote -C \"update-cache -f\"";
# Greatest abbreviations downloader ever
dlmp3 = "yt-dlp --embed-thumbnail -o \"%(channel)s - %(title)s.%(ext)s\" -f bestaudio -x --audio-format mp3 --audio-quality 320 ?";
dlmp4 = "yt-dlp --embed-thumbnail -S res,ext:mp4:m4a --recode mp4 ?";
# Git
gitpt = "set -l TAG_NAME (jq .version package.json -r); set -l TIMESTAMP (date +'%Y/%m/%d'); git tag -s $TAG_NAME -m \"$TIMESTAMP\"; git push origin --tag";
# Lazy
lzd = "lazydocker";
lzg = "lazygit";
# Wifi
setnm = "set NETWORK_NAME (nmcli -t -f NAME connection show --active | head -n 1)";
nmwon = "nmcli radio wifi on";
nmwoff = "nmcli radio wifi off";
nmwconn = "nmcli device wifi connect ?";
nmreconn = "nmcli connection down $NETWORK_NAME; and nmcli connection up $NETWORK_NAME";
nmwscan = "nmcli device wifi rescan";
nmwls = "nmcli device wifi list";
nmactive = "nmcli connection show --active";
nmup = "nmcli connection up $NETWORK_NAME";
nmdown = "nmcli connection down $NETWORK_NAME";
nmdnsv4-cloudflare = "nmcli connection modify $NETWORK_NAME ipv4.dns \"1.1.1.1,1.0.0.1\"";
nmdnsv6-cloudflare = "nmcli connection modify $NETWORK_NAME ipv6.dns \"2606:4700:4700::1111,2606:4700:4700::1001\"";
nmdnsv4-quad9 = "nmcli connection modify $NETWORK_NAME ipv4.dns \"9.9.9.9,149.112.112.112\"";
nmdnsv6-quad9 = "nmcli connection modify $NETWORK_NAME ipv6.dns \"2620:fe::fe,2620:fe::9\"";
v = "nvim";
# Greatest abbreviations ever
fv = "fd -H -I -E .angular -E .git -E dist -E node_modules -E target | fzf --reverse | xargs -r nvim";
# Zellij
zla = "zellij a";
zld = "zellij d ?";
zls = "zellij ls";
zlda = "zellij da -y";
zl = "zellij -s Main";
};
shellAliases = {
docker = "podman";
la = "eza -ahlT --color never -L 1 --time-style relative";
lg = "eza -hlT --git --color never -L 1 --time-style relative";
ll = "eza -hlT --color never -L 1 --time-style relative";
ls = "eza -hT --color never -L 1";
# Safety rm
rm = "trash-put";
tree = "eza -T --color never";
};
shellInit = ''
# Delete history on cmd error
function delete_cmd_error --on-event fish_postexec
if test $status = 1 || test $status = 127 && test "$argv" != "exit"
echo "$(date +'%-l:%M:%S') -> $argv" | tee -a /tmp/cmd_error.txt > /dev/null
history delete --case-sensitive --exact "$argv"
end
end
# https://github.com/jorgebucaran/humantime.fish
function humantime -a ms
set -q ms[1] || return
set -l secs (math --scale=1 $ms/1000 % 60)
set -l mins (math --scale=0 $ms/60000 % 60)
set -l hours (math --scale=0 $ms/3600000)
test $hours -gt 0 && set -l -a out $hours"h"
test $mins -gt 0 && set -l -a out $mins"m"
test $secs -gt 0 && set -l -a out $secs"s"
set -q out && echo $out || echo $ms"ms"
end
# Left side prompt
function fish_prompt
set -l last_status $status
set -l stat
if test $last_status -ne 0
set stat (set_color red)" [$last_status]"(set_color normal)
end
# Check if the current directory is a git repository
set -l git_rev
set -l git_branch
if test -d .git
set git_rev (set_color cyan)(git rev-parse --short HEAD 2>/dev/null)
set git_branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)(set_color normal)
end
if test -n "$git_branch" && test -n "$git_rev"
set -l git_status (git status --porcelain 2>/dev/null)
if test -n "$git_status"
set -l indicator (set_color yellow)"!"(set_color normal)
string join "" -- (set_color normal) "\$ " (prompt_pwd) $stat " $git_rev:$git_branch " "$indicator> "
else
string join "" -- (set_color normal) "\$ " (prompt_pwd) $stat " $git_rev:$git_branch" " > "
end
else
if test -d .git
string join "" -- (set_color normal) "\$ " (prompt_pwd) $stat (set_color cyan)" git?"(set_color normal) " > "
else
string join "" -- (set_color normal) "\$ " (prompt_pwd) $stat " > "
end
end
end
# Right side prompt
function fish_right_prompt
set -l time_d (humantime $CMD_DURATION)
echo -n " $time_d"
end
#
set -U fish_greeting
set -gx DOCKER_BUILDKIT 1
set -gx DOCKER_HOST unix:///run/user/1000/podman/podman.sock
set -gx GPG_TTY (tty)
set -gx NODE_OPTIONS --max-old-space-size=8192
'';
functions = {
"screenshot_entire_screen -S" = ''
set -l output_dir ~/Pictures/screenshot/entire-screen
set -l timestamp (date +'%F-%T')
set -l output_file $output_dir/ss-$timestamp.png
grim $output_file
notify-send "Screenshot" "Entire screen saved" -t 2000
'';
"screenshot_on_window_focus -S" = ''
set -l output_dir ~/Pictures/screenshot/window-focus
set -l timestamp (date +'%F-%T')
set -l output_file $output_dir/ss-$timestamp.png
grim -g (swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp) $output_file
notify-send "Screenshot" "Focus window screen saved" -t 2000
'';
"screenshot_selected_area -S" = ''
set -l output_dir ~/Pictures/screenshot/selected-area
set -l timestamp (date +'%F-%T')
set -l output_file $output_dir/ss-$timestamp.png
grim -g (slurp) $output_file
notify-send "Screenshot" "Selected area saved" -t 2000
'';
};
};
programs = {
alacritty = {
enable = true;
settings = {
terminal.shell = {
program = "${config.home.profileDirectory}/bin/fish";
};
general.live_config_reload = false;
font = {
normal = {
family = "FiraCode Nerd Font";
style = "Regular";
};
size = 15;
};
colors = {
primary.foreground = "#ffffff";
primary.background = "#000000";
normal.red = "#ff4d4f";
normal.blue = "#096dd9";
normal.green = "#52c41a";
normal.yellow = "#faad14";
normal.black = "#000000";
normal.white = "#ffffff";
normal.cyan = "#08979c";
normal.magenta = "#c41d7f";
};
cursor = {
style = {
shape = "Beam";
blinking = "Always";
};
vi_mode_style = {
shape = "Beam";
blinking = "Always";
};
blink_interval = 400;
blink_timeout = 0;
};
mouse.hide_when_typing = true;
window = {
decorations = "None";
decorations_theme_variant = "Dark";
padding = {
x = 12;
y = 0;
};
dynamic_padding = true;
opacity = 0.95;
startup_mode = "Maximized";
};
selection.save_to_clipboard = true;
};
package = nixglWrap pkgs.alacritty;
};
bat = {
enable = true;
config = {
italic-text = "never";
pager = "less -FR";
theme = "base16";
wrap = "never";
};
};
btop = {
enable = true;
settings = {
show_battery = false;
temp_scale = "celsius";
update_ms = 1000;
clock_format = "";
rounded_corners = false;
log_level = "WARNING";
};
};
bun = {
enable = true;
package = bunBin;
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
eza.enable = true;
fastfetch = {
enable = true;
settings = {
logo = {
type = "small";
color = {
"1" = "white";
};
};
display = {
color = "white";
};
modules = [
"title"
"separator"
"os"
{
type = "host";
format = "{?2}{2}{?}{?5} ({5}){?}";
}
"kernel"
{
type = "wm";
key = "Window Manager";
}
{
type = "de";
key = "Desktop Environment";
}
"break"
"chassis"
"cpu"
"gpu"
"memory"
"swap"
"disk"
"break"
"shell"
"packages"
"terminal"
"break"
"uptime"
{
type = "display";
key = "Resolution";
}
"locale"
"break"
];
};
};
fd = {
enable = true;
hidden = true;
ignores = [
".git/"
".angular/"
".database/"
".firebase/"
"node_modules/"
"target/"
];
extraOptions = [
"-tf"
"--no-require-git"
];
};
fzf.enable = true;
java.enable = true;
jq.enable = true;
lazygit = {
enable = true;
settings = {
gui = {
border = "single";
};
git = {
merging = {
args = "-S";
};
mainBranches = [
"master"
"main"
"dev"
"next"
];
};
};
};
neovim = {
enable = true;
defaultEditor = true;
plugins = with pkgs.vimPlugins; [
{
plugin = gitsigns-nvim;
type = "lua";
config = ''
-- https://github.com/lewis6991/gitsigns.nvim
require("gitsigns").setup({
signs = {
add = { text = "A" },
change = { text = "C" },
delete = { text = "D" },
topdelete = { text = "TD" },
changedelete = { text = "CD" },
untracked = { text = "U" },
},
signs_staged = {
add = { text = "SA" },
change = { text = "SC" },
delete = { text = "SD" },
topdelete = { text = "S-" },
changedelete = { text = "S~" },
untracked = { text = "SU" },
},
})
'';
}
{
plugin = indent-blankline-nvim;
type = "lua";
config = ''
-- https://github.com/lukas-reineke/indent-blankline.nvim
require("ibl").setup{
debounce = 100,
indent = {
char = { "" },
},
scope = {
enabled = false,
},
}
local iblhooks = require "ibl.hooks"
iblhooks.register(
iblhooks.type.WHITESPACE,
iblhooks.builtin.hide_first_space_indent_level
)
iblhooks.register(
iblhooks.type.WHITESPACE,
iblhooks.builtin.hide_first_tab_indent_level
)
'';
}
lsp-zero-nvim
nvim-lspconfig
nvim-cmp
# https://github.com/b0o/SchemaStore.nvim
SchemaStore-nvim
{
plugin = cmp-nvim-lsp;
type = "lua";
config = ''
-- https://github.com/VonHeikemen/lsp-zero.nvim
local lspconfig_defaults = require("lspconfig").util.default_config
lspconfig_defaults.capabilities = vim.tbl_deep_extend(
"force",
lspconfig_defaults.capabilities,
require("cmp_nvim_lsp").default_capabilities()
)
vim.api.nvim_create_autocmd("LspAttach", {
desc = "LSP actions",
callback = function(event)
local opts = { buffer = event.buf, silent = true }
vim.keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.keymap.set("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.keymap.set("n", "go", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
vim.keymap.set("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
vim.keymap.set("n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.keymap.set("n", "<F2>", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.keymap.set({"n", "x"}, "<F3>", "<cmd>lua vim.lsp.buf.format({async = true})<CR>", opts)
vim.keymap.set("n", "<F4>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
end,
})
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
-- Angular
local ngcmd = {
"${angularLanguageServer}/node_modules/.bin/ngserver",
"--stdio",
"--tsProbeLocations",
"${angularLanguageServer}/node_modules",
"--ngProbeLocations",
"${angularLanguageServer}/node_modules",
}
local lspconfig = require("lspconfig")
lspconfig.angularls.setup{
cmd = ngcmd,
on_new_config = function(new_config, new_root_dir)
new_config.cmd = ngcmd
end,
}
-- Bash
lspconfig.bashls.setup{}
-- C
lspconfig.clangd.setup{}
-- cmake
lspconfig.cmake.setup{}
-- CSS
lspconfig.cssls.setup{}
-- Dockerfile
lspconfig.dockerls.setup{}
-- HTML
lspconfig.html.setup{}
-- Java
lspconfig.jdtls.setup{}
-- JSON
lspconfig.jsonls.setup{
settings = {
json = {
schemas = require("schemastore").json.schemas {
select = {
"cloudbuild.json",
"Firebase",
"Google Cloud Workflows",
"openapi.json",
"package.json",
"tsconfig.json"
}
},
validate = {
enable = true
}
}
}
}
-- Nginx
lspconfig.nginx_language_server.setup{}
-- Nix
lspconfig.nil_ls.setup{}
-- R
lspconfig.r_language_server.setup{}
-- Rust
lspconfig.rust_analyzer.setup{}
-- Typescript
lspconfig.ts_ls.setup{}
-- YAML
lspconfig.yamlls.setup{
settings = {
yaml = {
validate = true,
schemas = {
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "/*-compose.{yaml,yml}",
},
},
}
}
-- Zig
lspconfig.zls.setup{}
'';
}
vim-vsnip
cmp-vsnip
{
plugin = nvim-cmp;
type = "lua";
config = ''
-- https://github.com/hrsh7th/nvim-cmp
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "vsnip" },
}, {
{ name = "buffer" },
})
})
'';
}
plenary-nvim
telescope-fzf-native-nvim
telescope-live-grep-args-nvim
{
plugin = telescope-nvim;
type = "lua";
config = ''
-- https://github.com/nvim-telescope/telescope.nvim
require("telescope").setup{
defaults = {
file_ignore_patterns = {
"^.angular/",
"^.database/",
"^.firebase/",
"^.git/",
"^dist/",
"^node_modules/",
"^target/"
},
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--line-number",
"--column",
"--smart-case",
"--hidden",
"--no-ignore-files",
"--no-require-git"
}
},
pickers = {
find_files = {
hidden = true,
no_ignore = true,
disable_devicons = true,
file_ignore_patterns = {
"^.angular/",
"^.database/",
"^.firebase/",
"^.git/",
"^dist/",
"^node_modules/",
"^target/"
},
find_command = {
"fd",
".",
"-tf",
"--hidden",
"--strip-cwd-prefix",
"--no-require-git"
}
},
},