-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.nix
1408 lines (1276 loc) · 46.6 KB
/
configuration.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
{
###### Imports ###### {{{
lib,
host,
pkgs,
self,
config,
inputs,
conHome,
options,
conUsername,
conFlakePath,
...
}: {
imports =
[
inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.default
({config, ...}: {
options = {
const =
config.constLib.mkConstsFromSet {
accentColor = "7d8618";
}
// config.constLib.mkConstsFromSetInsanity {
libs = [
pkgs.libGL
pkgs.gcc
pkgs.libgcc
pkgs.e2fsprogs
# X11 libs
pkgs.xcb-util-cursor
pkgs.xorg.xcbutilwm
pkgs.xorg.xcbutilrenderutil
pkgs.xorg.xcbutilkeysyms
pkgs.xorg.xcbutilerrors
pkgs.xorg.libxcb
pkgs.xorg.xcbutilimage
pkgs.libxkbcommon
pkgs.xorg.libX11
pkgs.xorg.libXrandr
pkgs.xorg.libXScrnSaver
pkgs.xorg.libXext
];
};
};
})
]
++ lib.my.withModules [
"myConstants.nix"
"myNeovim.nix"
"myTerminal.nix"
"myXMonad.nix"
"myAwesome.nix"
"myZSH.nix"
"myMPV.nix"
"myTmux.nix"
"myAichat.nix"
"myThunar.nix"
"myGaming.nix"
"myPackages.nix"
"myAudioEffects.nix"
"mySyncthing.nix"
"myStupid.nix"
"myTemplates.nix"
"myXDGDirsEnforcement.nix"
"visuals/myTheme.nix"
"visuals/myThemeCore.nix"
"visuals/myKvantumBasedQT.nix"
# "visuals/myGtkBasedQT.nix"
# "visuals/myNixBasedQT.nix"
# "visuals/myGnomeBasedQT.nix"
# "visuals/myAdwaitaDarkQT.nix"
# "visuals/myImperativeKvantumBasedQT.nix"
];
# }}}
###### Custom ###### {{{
custom.defaultTerminal = pkgs.alacritty;
# }}}
###### Essential or basic. ###### {{{
services.dbus = {
enable = true;
implementation = "broker";
};
documentation = {
enable = true;
dev.enable = true;
doc.enable = true;
info.enable = false;
man = {
enable = true;
generateCaches = true;
man-db.enable = true;
mandoc.enable = false;
};
};
# Needed for building, by default its set to 10% of ram, which might
# not be enough for low ram systems causing an "out of space" error when
# trying to build. This will still happen with this option, since you need
# the resize first to apply this config. Put this line in the vanilla config,
# rebuild, and then build my config.
services.logind.extraConfig = "RuntimeDirectorySize=4G";
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.xserver.wacom.enable = true;
environment.binsh = lib.getExe pkgs.dash;
# Faster boot
boot.initrd.systemd.network.wait-online.enable = false;
networking.dhcpcd.wait = "background";
networking.hostName = "${host}";
# DNS
services.resolved.enable = false;
networking.networkmanager.dns = "none";
networking.resolvconf.enable = lib.mkForce false;
networking.dhcpcd.extraConfig = "nohook resolv.conf";
networking.nameservers = ["9.9.9.9" "149.112.112.112"];
networking.firewall.enable = true;
time.timeZone = "Europe/Warsaw";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_NAME = "pl_PL.UTF-8";
LC_TIME = "pl_PL.UTF-8";
LC_CTYPE = "pl_PL.UTF-8";
LC_PAPER = "pl_PL.UTF-8";
LC_ADDRESS = "pl_PL.UTF-8";
LC_COLLATE = "pl_PL.UTF-8";
LC_NUMERIC = "pl_PL.UTF-8";
LC_MONETARY = "pl_PL.UTF-8";
LC_TELEPHONE = "pl_PL.UTF-8";
LC_MEASUREMENT = "pl_PL.UTF-8";
LC_IDENTIFICATION = "pl_PL.UTF-8";
};
};
services.xserver.xkb = {
layout = "pl,plfi";
options = "caps:escape,grp:sclk_toggle";
extraLayouts.plfi = {
languages = ["pol"];
symbolsFile = builtins.toFile "plfi" ''
default partial alphanumeric_keys
xkb_symbols "basic" {
include "latin"
name[Group1]="Polish-Fin";
key <AE01> { [ 1, exclam, notequal, exclamdown ] };
key <AE02> { [ 2, at, twosuperior, questiondown ] };
key <AE04> { [ 4, dollar, cent, onequarter ] };
key <AE05> { [ 5, percent, EuroSign, U2030 ] };
key <AE06> { [ 6, asciicircum, onehalf, logicaland ] };
key <AE07> { [ 7, ampersand, section, U2248 ] };
key <AE08> { [ 8, asterisk, periodcentered, threequarters ] };
key <AE09> { [ 9, parenleft, guillemotleft, plusminus ] };
key <AE10> { [ 0, parenright, guillemotright, degree ] };
key <AE11> { [ minus, underscore, endash, emdash ] };
key <AD01> { [ q, Q, Greek_pi, Greek_OMEGA ] };
key <AD02> { [ w, W, oe, OE ] };
key <AD03> { [ e, E, eogonek, Eogonek ] };
key <AD04> { [ r, R, copyright, registered ] };
key <AD05> { [ t, T, ssharp, trademark ] };
key <AD08> { [ i, I, rightarrow, U2194 ] };
key <AD09> { [ o, O, U00F6, U00D6 ] };
key <AC01> { [ a, A, U00E4, U00C4 ] };
key <AC02> { [ s, S, sacute, Sacute ] };
key <AC04> { [ f, F, ae, AE ] };
key <AC06> { [ h, H, rightsinglequotemark, U2022 ] };
key <AC07> { [ j, J, schwa, SCHWA ] };
key <AC08> { [ k, K, ellipsis, dead_stroke ] };
key <TLDE> { [ grave, asciitilde, notsign, logicalor ] };
key <AB01> { [ z, Z, zabovedot, Zabovedot ] };
key <AB02> { [ x, X, zacute, Zacute ] };
key <AB03> { [ c, C, cacute, Cacute ] };
key <AB04> { [ v, V, doublelowquotemark, leftsinglequotemark ] };
key <AB05> { [ b, B, rightdoublequotemark, leftdoublequotemark ] };
key <AB06> { [ n, N, nacute, Nacute ] };
key <AB07> { [ m, M, mu, infinity ] };
key <AB08> { [ comma, less, lessthanequal, multiply ] };
key <AB09> { [ period, greater, greaterthanequal, division ] };
key <SPCE> { [ space, space, nobreakspace, nobreakspace ] };
include "kpdl(comma)"
include "level3(ralt_switch)"
};
'';
description = "Polish finnish layout";
};
};
console = {
useXkbConfig = true;
font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz";
};
# Define a user account. Don't forget to set a password with ‘passwd $USERNAME’.
users.users.${conUsername} = {
isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "video"]; # Enable ‘sudo’ for the user.
# Video allows to set brightness.
};
# Keep sudo password cached infinitely.
security.sudo.extraConfig = ''
Defaults timestamp_timeout=-1
'';
# }}}
###### NixOS programs ###### {{{
# Appimage support.
programs.appimage = {
enable = true;
binfmt = true;
};
programs.gnupg.agent.enable = true;
programs.gnupg.agent.enableSSHSupport = true;
# Camera support.
programs.gphoto2.enable = true;
# Fixes dolphin not having mime types.
environment.etc."/xdg/menus/applications.menu".text =
# This one also works but has to pull in entire plasma workspaces, but might be more future proof
# builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
''
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Name>Applications</Name>
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<DefaultMergeDirs/>
</Menu>
'';
# System packages.
environment.systemPackages = with pkgs;
[
cups
# Audio
tap-plugins
( # Patch package so it doesn't spam menu entries
pkgs.runCommand "lsp-plugins-no-xdg-menu" {}
''
cp -R ${pkgs.lsp-plugins} $out
chown -R $(id -u):$(id -g) $out/share/applications
chmod -R 777 $out/share/applications
rm -f $out/share/applications/*.desktop
''
)
zam-plugins
airwindows-lv2
molot-lite
eq10q
# Nix.
nh # Nix helper
alejandra # Nix formatter
nixd # Another nix LSP (For Zed)
nix-tree # Reverse dependency search
nix-output-monitor # Pretty nix build output
# All the archive garbage.
xz
zip
gzip
lzip
bzip2
p7zip
unzip
gnutar
unrar-free
atool # Unified CLI for all of these:
# Camera files support.
gphoto2fs
# CLI.
eza
deno
ncdu
vlock
pipenv
rclone
busybox
exiftool
alsa-utils
moar # Pager
jq # Json parser
termdown # Timer
gcc # C compiling
vim # Text editor
wget # Downloader
tokei # Line counter
udiskie # Auto mount
cbonsai # pretty tree
gnumake # C compiling
gtrash # Cli trashcan
file # File identifier
zoxide # Cd alternative
devenv # Dev environments
libqalculate # Calculator
udftools # Udf filesystem
htop-vim # TUI task manager
pulsemixer # Volume control
ripgrep # Multithreaded grep
xdg-utils # Includes xdg-open
imagemagick # Image identifier
ffmpeg # Video and magic editor
gmic # Image processing language
libnotify # Notifications (notify-send)
python312Packages.ptpython # Python repl
ntfs3g # ntfs filesystem interop (windows fs)
# GUI.
carla
calibre
foliate
scribus
prismlauncher
krita # Painting
anki # Flashcards
libreoffice # office
nsxiv # Image viewer
simplescreenrecorder
godot_4 # Game engine
sayonara # Music player
inkscape # Vector graphics
keepassxc # Password manager
qbittorrent # Torrent client
qalculate-gtk # Gui calculator
mission-center # GUI task manager
kdePackages.dolphin # File manager
localsend # Send via local network
xdragon # drag items from terminal
jetbrains.pycharm-community-src # python IDE
# Browsers.
# Librewolf is currently broken
# librewolf
firefox
tor-browser
ungoogled-chromium
# Writing.
typst
asciidoctor
texliveBasic
pandoc # document converter
# Haskell.
stack
cabal-install
ghc # Haskell compiler for the LSP
haskell-language-server # Haskell LSP
]
++ (
if (config.const.importedMyMPVModule or false)
then [python3]
else []
);
# }}}
###### Miscellaneous ###### {{{
programs.dconf.enable = true;
xdg.menus.enable = true;
# Create media folder in root
systemd.tmpfiles.rules = [
"d /media 0755 root root"
];
# Envvar, envars. User ones go into home manager.
environment.sessionVariables = {
FLAKE = "${conFlakePath}"; # For nix helper.
};
# This allows for programs to see audio plugins
environment.variables = let
homeConfig = config.home-manager.users.${conUsername};
makePluginPath = format:
(lib.makeSearchPath format [
"$HOME/.nix-profile/lib"
"/run/current-system/sw/lib"
"/etc/profiles/per-user/$USER/lib"
])
+ ":${homeConfig.xdg.dataHome}/.${format}";
in {
DSSI_PATH = makePluginPath "dssi";
LADSPA_PATH = makePluginPath "ladspa";
LV2_PATH = makePluginPath "lv2";
LXVST_PATH = makePluginPath "lxvst";
VST_PATH = makePluginPath "vst";
VST3_PATH = makePluginPath "vst3";
};
# Fixes issues with broken portal
systemd.user.services."wait-for-full-path-gtk" = {
description = "wait for systemd units to have full PATH";
wantedBy = ["xdg-desktop-portal-gtk.service"];
before = ["xdg-desktop-portal-gtk.service"];
path = with pkgs; [systemd coreutils gnugrep];
script = ''
ispresent () {
systemctl --user show-environment | grep -E '^PATH=.*/.nix-profile/bin'
}
while ! ispresent; do
sleep 0.1;
done
'';
serviceConfig = {
Type = "oneshot";
TimeoutStartSec = "60";
};
};
system.stateVersion = "24.05"; # Don't change.
# }}}
##### NixOS ###### {{{
# Keep trace of flake hash and flake for every gen in /etc
system.extraSystemBuilderCmds = "ln -s ${self.sourceInfo.outPath} $out/src";
environment.etc."flake-rev.json".text = builtins.toJSON {inherit (self) sourceInfo;};
environment.etc."flake-src".source = lib.my.relativeToRoot ".";
nixpkgs.config.allowUnfree = lib.mkForce false;
nix = {
# extraOptions = ''
# extra-substituters = https://devenv.cachix.org
# extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
# '';
channel.enable = false;
settings = {
warn-dirty = true;
auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
};
registry.nixpkgs.flake = self.inputs.nixpkgs;
registry.nixpkgs-unstable.flake = self.inputs.nixpkgs-unstable;
nixPath = [
"nixpkgs=${self.inputs.nixpkgs}"
"nixpkgs-unstable=${self.inputs.nixpkgs-unstable}"
];
};
programs.nix-ld.enable = true;
## If needed, you can add missing libraries here. nix-index-database is your friend to
## find the name of the package from the error message:
## https://github.com/nix-community/nix-index-database
programs.nix-ld.libraries =
options.programs.nix-ld.libraries.default
++ config.const.libs;
# }}}
###### Services ###### {{{
# Printing.
services.printing.enable = true;
services.printing.cups-pdf.enable = true;
# Needed for secrets.
services.gnome.gnome-keyring.enable = true;
# Automount.
services.udisks2.enable = true;
services.udev.extraRules = ''
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
'';
services.libinput.enable = true;
services.xserver.autoRepeatDelay = 170;
services.xserver.autoRepeatInterval = 45;
services.libinput.mouse.middleEmulation = false;
services.libinput.mouse.accelProfile = "adaptive";
# }}}
##### Home Manager ###### {{{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit inputs;};
backupFileExtension = "backup"; # home-manager breaks without it.
users.${conUsername} = {
lib,
config,
osConfig,
...
}: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
inputs.nix-index-database.hmModules.nix-index
];
# Prevent default apps from being changed
xdg.configFile."mimeapps.list".force = true;
xdg.mimeApps = {
enable = true;
associations.added = config.xdg.mimeApps.defaultApplications;
defaultApplications = let
inherit (config.home.sessionVariables) EDITOR;
inherit (config.home.sessionVariables) BROWSER;
in {
"text/plain" = "${EDITOR}.desktop";
"text/rhtml" = "${EDITOR}.desktop";
"text/x-tex" = "${EDITOR}.desktop";
"text/x-java" = "${EDITOR}.desktop";
"text/x-ruby" = "${EDITOR}.desktop";
"text/x-cmake" = "${EDITOR}.desktop";
"text/markdown" = "${EDITOR}.desktop";
"text/x-python" = "${EDITOR}.desktop";
"text/x-readme" = "${EDITOR}.desktop";
"text/x-markdown" = "${EDITOR}.desktop";
"application/json" = "${EDITOR}.desktop";
"application/x-ruby" = "${EDITOR}.desktop";
"application/x-yaml" = "${EDITOR}.desktop";
"application/x-docbook+xml" = "${EDITOR}.desktop";
"application/x-shellscript" = "${EDITOR}.desktop";
"image/bmp" = "nsxiv.desktop";
"image/gif" = "nsxiv.desktop";
"image/jpg" = "nsxiv.desktop";
"image/jxl" = "nsxiv.desktop";
"image/png" = "nsxiv.desktop";
"image/avif" = "nsxiv.desktop";
"image/heif" = "nsxiv.desktop";
"image/jpeg" = "nsxiv.desktop";
"image/tiff" = "nsxiv.desktop";
"image/webp" = "nsxiv.desktop";
"image/x-eps" = "nsxiv.desktop";
"image/x-ico" = "nsxiv.desktop";
"image/x-psd" = "nsxiv.desktop";
"image/x-tga" = "nsxiv.desktop";
"image/x-icns" = "nsxiv.desktop";
"image/x-webp" = "nsxiv.desktop";
"image/svg+xml" = "nsxiv.desktop";
"image/x-xbitmap" = "nsxiv.desktop";
"image/x-xpixmap" = "nsxiv.desktop";
"image/x-portable-bitmap" = "nsxiv.desktop";
"image/x-portable-pixmap" = "nsxiv.desktop";
"image/x-portable-graymap" = "nsxiv.desktop";
"image/vnd.djvu" = "org.pwmt.zathura.desktop";
"application/pdf" = "org.pwmt.zathura.desktop";
"video/dv" = "mpv.desktop";
"video/3gp" = "mpv.desktop";
"video/avi" = "mpv.desktop";
"video/fli" = "mpv.desktop";
"video/flv" = "mpv.desktop";
"video/mp4" = "mpv.desktop";
"video/ogg" = "mpv.desktop";
"video/3gpp" = "mpv.desktop";
"video/divx" = "mpv.desktop";
"video/mp2t" = "mpv.desktop";
"video/mpeg" = "mpv.desktop";
"video/webm" = "mpv.desktop";
"video/3gpp2" = "mpv.desktop";
"video/x-avi" = "mpv.desktop";
"video/x-flv" = "mpv.desktop";
"video/x-m4v" = "mpv.desktop";
"video/x-ogm" = "mpv.desktop";
"video/mp4v-es" = "mpv.desktop";
"video/msvideo" = "mpv.desktop";
"video/x-mpeg2" = "mpv.desktop";
"video/vnd.divx" = "mpv.desktop";
"video/x-ms-asf" = "mpv.desktop";
"video/x-ms-wmv" = "mpv.desktop";
"video/x-ms-wmx" = "mpv.desktop";
"video/x-theora" = "mpv.desktop";
"video/quicktime" = "mpv.desktop";
"video/x-msvideo" = "mpv.desktop";
"video/x-ogm+ogg" = "mpv.desktop";
"video/x-matroska" = "mpv.desktop";
"video/vnd.mpegurl" = "mpv.desktop";
"video/x-theora+ogg" = "mpv.desktop";
"application/x-matroska" = "mpv.desktop";
"video/vnd.rn-realvideo" = "mpv.desktop";
"audio/aac" = "mpv.desktop";
"audio/mp4" = "mpv.desktop";
"audio/ogg" = "mpv.desktop";
"audio/mpeg" = "mpv.desktop";
"audio/x-mp3" = "mpv.desktop";
"audio/x-wav" = "mpv.desktop";
"audio/vorbis" = "mpv.desktop";
"audio/x-flac" = "mpv.desktop";
"audio/mpegurl" = "mpv.desktop";
"audio/x-scpls" = "mpv.desktop";
"audio/x-speex" = "mpv.desktop";
"audio/x-ms-wma" = "mpv.desktop";
"audio/x-vorbis" = "mpv.desktop";
"audio/x-mpegurl" = "mpv.desktop";
"audio/x-oggflac" = "mpv.desktop";
"audio/x-musepack" = "mpv.desktop";
"audio/x-vorbis+ogg" = "mpv.desktop";
"audio/x-pn-realaudio" = "mpv.desktop";
"audio/vnd.rn-realaudio" = "mpv.desktop";
"text/html" = "${BROWSER}.desktop";
"x-scheme-handler/ftp" = "${BROWSER}.desktop";
"application/xhtml+xml" = "${BROWSER}.desktop";
"x-scheme-handler/http" = "${BROWSER}.desktop";
"x-scheme-handler/https" = "${BROWSER}.desktop";
"x-scheme-handler/chrome" = "${BROWSER}.desktop";
"application/x-extension-htm" = "${BROWSER}.desktop";
"application/x-extension-xht" = "${BROWSER}.desktop";
"application/x-extension-html" = "${BROWSER}.desktop";
"application/x-extension-shtml" = "${BROWSER}.desktop";
"application/x-extension-xhtml" = "${BROWSER}.desktop";
};
};
home = {
username = "${conUsername}";
homeDirectory = "${conHome}";
stateVersion = "24.05"; # Don't change.
shellAliases = {
"ls" = "eza";
"cp" = "cp -v";
"rm" = "rm -I";
"la" = "eza -a";
"ll" = "eza -l";
"qcalc" = "qalc";
"lla" = "eza -la";
"rt" = "gtrash put";
"archive" = "patool";
"pkill" = "pkill -f";
"countlines" = "tokei";
"f" = ''cd "$(fzfcd)"'';
"shutdown" = "poweroff";
"lock" = "sudo vlock -nas";
"grep" = "grep --color=auto";
"cbonsai" = "cbonsai --screensaver";
"pmem" = "vmrss"; # [p]rocess [mem]ory
"date" = ''date +"%A, %d %B %Y, %H:%M:%S"'';
"backup" = "sudo borgmatic --verbosity 1 --list --stats";
"plan" = "nsxiv ${config.home.homeDirectory}/Sync/notes/plan.png";
"nhoffline" = "nh os switch ${conFlakePath} -- --option substitute false";
"listinstalledpackages" = "nix-store --query --requisites /run/current-system | cut -d- -f2- | sort -u";
"record" = "arecord -t wav -r 48000 -c 1 -f S16_LE ${config.home.homeDirectory}/screencaptures/recording.wav";
"search" = "sudo echo 'got sudo' && sudo find / -maxdepth 99999999 2>/dev/null | ${lib.getExe pkgs.fzf} -i -q $1";
};
sessionVariables = {
# Default programs.
PAGER = "moar";
BROWSER = "firefox";
OPENER = "xdg-open";
EDITOR = lib.mkDefault "vim";
VISUAL = config.home.sessionVariables.EDITOR;
SUDO_EDITOR = config.home.sessionVariables.EDITOR;
# Unreal engine .net cli tool turn off telemetry.
DOTNET_CLI_TELEMETRY_OPTOUT = "true";
# Without this, games that use SDL will minimize when focus is lost
SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 0;
# Systemd is retarded and doesn't use normal pager variable :DDDDD
SYSTEMD_PAGER = config.home.sessionVariables.PAGER;
};
activation.directories = lib.hm.dag.entryAfter ["writeBoundary"] ''
run mkdir -p "${config.home.homeDirectory}/Pictures/screenshots"
run mkdir -p "${config.home.homeDirectory}/backups"
run mkdir -p "${config.home.homeDirectory}/screencaptures"
'';
};
# Wayland, X, etc. support for session variables.
systemd.user.sessionVariables = config.home.sessionVariables;
# Development, internal.
programs.bash.enable = true;
programs.zoxide.enable = true;
programs.nix-index.enable = true;
programs.home-manager.enable = true;
programs.git-credential-oauth.enable = true;
stylix.targets.zathura.enable = false;
programs.zathura = let
color = config.lib.stylix.colors.withHashtag;
inherit (config.stylix) fonts;
in {
enable = true;
options = {
selection-clipboard = "clipboard";
guioptions = "s";
adjust-open = "width";
statusbar-h-padding = 0;
statusbar-v-padding = 0;
scroll-page-aware = true;
statusbar-home-tilde = true;
font = "${fonts.serif.name} ${builtins.toString fonts.sizes.terminal}";
recolor = false;
recolor-keephue = false;
notification-error-bg = "${color.base00}"; # bg
notification-error-fg = "${color.base08}"; # bright:red
notification-warning-bg = "${color.base00}"; # bg
notification-warning-fg = "${color.base0A}"; # bright:yellow
notification-bg = "${color.base00}"; # bg
notification-fg = "${color.base0B}"; # bright:green
completion-bg = "${color.base02}"; # bg2
completion-fg = "${color.base06}"; # fg
completion-group-bg = "${color.base01}"; # bg1
completion-group-fg = "${color.base03}"; # gray
completion-highlight-bg = "${color.base0B}"; # bright:blue
completion-highlight-fg = "${color.base02}"; # bg2
# Define the color in index mode
index-bg = "${color.base02}"; # bg2
index-fg = "${color.base06}"; # fg
index-active-bg = "${color.base0B}"; # bright:blue
index-active-fg = "${color.base02}"; # bg2
inputbar-bg = "${color.base01}"; # bg
inputbar-fg = "${color.base06}"; # fg
statusbar-bg = "${color.base00}"; # bg2
statusbar-fg = "${color.base06}"; # fg
highlight-color = "${color.base0A}80"; # bright:yellow
highlight-active-color = "${color.base09}80"; # bright:orange
default-bg = "${color.base00}"; # bg
default-fg = "${color.base06}"; # fg
render-loading = true;
render-loading-bg = "${color.base00}"; # bg
render-loading-fg = "${color.base06}"; # fg
# Recolor book content's color
recolor-lightcolor = "${color.base00}"; # bg
recolor-darkcolor = "${color.base06}"; # fg
};
mappings = {
"<C-r>" = "reload";
"<C-j>" = "zoom in";
"<C-k>" = "zoom out";
i = "toggle_statusbar";
};
extraConfig = ''
unmap i
map i toggle_statusbar
'';
};
services.dunst = {
enable = true;
settings.global = {
width = 300;
height = 300;
offset = "30x50";
origin = "top-center";
};
};
programs.lazygit = {
enable = true;
settings = {
gui.border = "single";
git = {
commit.signOff = true;
branchLogCmd = "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium --oneline {{branchName}} --";
};
customCommands = [
{
key = "f";
command = "git difftool -y {{.SelectedLocalCommit.Sha}} -- {{.SelectedCommitFile.Name}}";
context = "commitFiles";
description = "Compare (difftool) with local copy";
}
{
key = "<c-a>";
description = "Pick AI commit";
command = ''
aichat "Please suggest 10 commit messages, given the following diff:
\`\`\`diff
$(git diff --cached)
\`\`\`
**Criteria:**
1. **Format:** Each commit message must follow the conventional commits format, which is \`<type>(<scope>): <description>\`.
2. **Relevance:** Avoid mentioning a module name unless it's directly relevant to the change.
3. **Enumeration:** List the commit messages from 1 to 10, but don't add the number itself.
4. **Clarity and Conciseness:** Each message should clearly and concisely convey the change made.
**Commit Message Examples:**
- fix(app): add password regex pattern
- test(unit): add new test cases
- style: remove unused imports
- refactor(pages): extract common code to \`utils/wait.ts\`
**Recent Commits on Repo for Reference:**
\`\`\`
$(git log -n 10 --pretty=format:'%h %s')
\`\`\`
**Output Template**
Follow this output template and ONLY output raw commit messages without spacing, numbers or other decorations.
fix(app): add password regex pattern
test(unit): add new test cases
style: remove unused imports
refactor(pages): extract common code to \`utils/wait.ts\`
**Instructions:**
- Take a moment to understand the changes made in the diff.
- Think about the impact of these changes on the project (e.g., bug fixes, new features, performance improvements, code refactoring, documentation updates). It's critical to my career you abstract the changes to a higher level and not just describe the code changes.
- Generate commit messages that accurately describe these changes, ensuring they are helpful to someone reading the project's history.
- Remember, a well-crafted commit message can significantly aid in the maintenance and understanding of the project over time.
- If multiple changes are present, make sure you capture them all in each commit message.
Keep in mind you will suggest 10 commit messages. Only 1 will be used. It's better to push yourself (esp to synthesize to a higher level) and maybe wrong about some of the 10 commits because only one needs to be good. I'm looking for your best commit, not the best average commit. It's better to cover more scenarios than include a lot of overlap.
Write your 10 commit messages below in the format shown in Output Template section above." \
| fzf --height 70% --ansi --preview "echo {}" --preview-window=up:wrap \
| xargs -I {} bash -c '
COMMIT_MSG_FILE=$(mktemp)
echo "{}" > "$COMMIT_MSG_FILE"
''${EDITOR:-vim} "$COMMIT_MSG_FILE"
if [ -s "$COMMIT_MSG_FILE" ]; then
git commit -F "$COMMIT_MSG_FILE"
else
echo "Commit message is empty, commit aborted."
fi
rm -f "$COMMIT_MSG_FILE"'
'';
context = "files";
subprocess = true;
}
];
};
};
programs.tealdeer = {
enable = true;
settings = {
updates.auto_update = true;
display = {
compact = false;
use_pager = true;
};
};
};
programs.yazi = {
enable = true;
keymap = {
manager.prepend_keymap = [
{
on = ["b"];
run = [
# https://github.com/sxyazi/yazi/discussions/327
''shell '${pkgs.ripdrag}/bin/ripdrag "$@" -x -n 2>/dev/null &' --confirm''
];
desc = "Drag and drop selection";
}
];
};
settings = {
preview.tab_size = 2;
manager = {
show_hidden = true;
show_symlink = true;
sort_by = "natural";
sort_dir_first = true;
};
opener = {
extract = [
{
run = ''aunpack "$@"'';
desc = "Extract here";
}
];
};
plugin = {
# Disable image previews
prepend_previewers = [
{
mime = "image/*";
run = "noop";
}
];
};
};
};
programs.fd = {
enable = true;
hidden = true;
ignores = [
".git"
".cache"
"devenv"
"direnv"
".direnv"
"lilipod"
"nix/store"
"nix/share"
"libraries"
"virtualenv"
"virtualenvs"
".local/state"
".nix-profile"
"nix/profiles"
"node_modules"
"cargo/registry"
".local/share/Trash"
];
extraOptions = [
"--glob"
];
};
programs.fzf = {
enable = true;
tmux.enableShellIntegration = true;
defaultCommand = "fd --type f";
defaultOptions = ["--no-height"];
fileWidgetCommand = "fd --type f";
changeDirWidgetCommand = "fd --type d";
fileWidgetOptions = ["--preview 'head {}'"];
changeDirWidgetOptions = ["--preview 'tree -C {} | head -200'"];
colors = {
"bg" = lib.mkForce "-1";
"bg+" = lib.mkForce "-1";
"gutter" = lib.mkForce "-1";
}; # Transparent fzf.
};
programs.btop = {
enable = true;
settings = {
theme_background = false;
vim_keys = true;
rounded_corners = false;
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.fastfetch = {
enable = true;
settings = {
modules = [
"title"
"separator"
"os"
"host"
"kernel"
"uptime"