-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.nix
558 lines (535 loc) · 15.3 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
{ inputs, config, pkgs, ... }:
{
nixpkgs.overlays = [inputs.nixpkgs-wayland.overlay];
nixpkgs.config.allowUnfree = true;
dconf = {
settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
};
};
xdg = {
portal = {
enable = true;
xdgOpenUsePortal = true;
config = {
common.default = [
"hyprland"
"wlr"
"gtk"
];
hyprland.default = [
"hyprland"
"wlr"
"gtk"
];
};
extraPortals = [
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland
inputs.nixpkgs-wayland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
};
};
home = {
sessionPath = [
"/home/karimi/.krew/bin"
"/home/karimi/.npm-packages/bin"
];
username = "karimi";
homeDirectory = "/home/karimi";
stateVersion = "25.05";
packages = with pkgs; [
kind
ansible
ansible-lint
kubectl
kubecolor
kubernetes-helm
krew
(minikube.override { withQemu = true; libvirt = pkgs.libvirt; } )
polkit
polkit_gnome
vim
(neovim.override {withNodeJs = true;})
tmux
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland
inputs.nixpkgs-wayland.packages.${system}.waybar
inputs.nixpkgs-wayland.packages.${system}.dunst
inputs.nixpkgs-wayland.packages.${system}.wlogout
inputs.nixpkgs-wayland.packages.${system}.wl-clipboard
inputs.nixpkgs-wayland.packages.${system}.wlr-randr
(hyprshot.override {hyprland = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; })
hyprpaper
hypridle
fuzzel
firefox
networkmanagerapplet
brightnessctl
playerctl
clipse
nerd-fonts.inconsolata
vazir-fonts
(jetbrains.datagrip.override {
vmopts = ''
-Xms512m
-Xmx8192m
-XX:ReservedCodeCacheSize=512m
-XX:+IgnoreUnrecognizedVMOptions
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
-Dsun.io.useCanonCaches=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Djdk.module.illegalAccess.silent=true
-Dkotlinx.coroutines.debug=off
-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
--add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
--add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED
-javaagent:/home/karimi/ja-netfilter/ja-netfilter.jar=jetbrains
'';
})
python3Full
go
gnumake
golines
gotools
reftools
golangci-lint
govulncheck
mockgen
impl
ginkgo
gofumpt
gomodifytags
iferr
delve
gopls
pyright
gcc
tree-sitter
nodejs_22
lua-language-server
nginx-language-server
python3Packages.python-lsp-server
python3Packages.debugpy
(luajit.withPackages(luajitPackages: [luajitPackages.magick luajitPackages.luarocks]))
devenv
nil
nixfmt-rfc-style
php
php.packages.composer
pnpm
podman-desktop
podman-compose
dive
cava
gimp
jq
lsd
btop
bat
dogdns
prettyping
viddy
nerdfetch
fastfetch
fzf
materialgram
p7zip
ripgrep
imagemagick
cargo
rustc
openssl
curlie
psmisc
gitmoji-cli
unzip
geek-life
nvtopPackages.full
smartmontools
cloudflare-warp
remmina
persepolis
qemu_full
glxinfo
usbutils
swtpm
procps
pciutils
rustdesk
anydesk
yazi
];
};
programs = {
obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-backgroundremoval
obs-pipewire-audio-capture
];
};
zoxide = {
enable = true;
enableZshIntegration = true;
options = [
"--cmd cd"
];
};
direnv = {
enable = true;
enableZshIntegration = true;
};
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
autocd = true;
initExtraFirst = ''
source "$HOME/.local/share/zsh/custom/themes/typewritten/typewritten.zsh-theme"
display_kube_context() {
tw_kube_context="\u2388 | $(kubectl config view --minify --output json | jq -r '(."contexts"[0]."context"."user" + "@" + ."contexts"[0]."context"."cluster" + ":" + ."contexts"[0]."context"."namespace")' 2> /dev/null)"
if [[ $tw_kube_context != "" ]]; then
echo -n "($tw_kube_context)"
fi
}
'';
shellAliases = {
ll = "ls -l";
upgrade = "sudo nix flake update --flake '/etc/nixos?submodules=1' && sudo nixos-rebuild switch --flake '/etc/nixos?submodules=1#default' --upgrade --upgrade-all -v";
update = "sudo nixos-rebuild switch --flake '/etc/nixos?submodules=1#default'";
make = "make -j$(nproc)";
ninja = "ninja -j$(nproc)";
c = "clear";
n = "ninja";
dir = "ls";
ls = "lsd -h --group-dirs first";
tree = "lsd --tree";
top = "btop";
htop = "btop";
bat = "bat --theme='Catppuccin Mocha'";
"-g -- --help" = "--help 2>&1 | bat --plain --language=help";
cat = "bat --pager=never";
less = "bat";
oldless = "bat --plain";
oldcat = "bat --plain --pager=never";
dig = "dog";
ping = "prettyping";
kubectl = "kubecolor";
k = "kubectl";
watch = "viddy";
tarnow = "tar -acf ";
wget = "wget -c ";
untar = "tar -zxvf ";
vim = "nvim";
vi = "nvim";
tb = "nc termbin.com 9999";
ssh = "kitten ssh";
oldssh = "/run/current-system/sw/bin/ssh";
icat = "kitten icat";
diff = "kitten diff";
curl = "curlie";
};
sessionVariables = {
MANPAGER = "sh -c 'col -bx | bat -l man'";
EDITOR = "nvim";
TYPEWRITTEN_SYMBOL = "λ ";
TYPEWRITTEN_PROMPT_LAYOUT = "half_pure";
TYPEWRITTEN_RELATIVE_PATH = "home";
TYPEWRITTEN_LEFT_PROMPT_PREFIX_FUNCTION = "display_kube_context";
HISTCONTROL = "ignoreboth";
KIND_EXPERIMENTAL_PROVIDER = "podman";
NODE_PATH = "/home/karimi/.npm-packages/lib/node_modules";
};
oh-my-zsh = {
enable = true;
plugins = [ "git" "extract" "timer" "fzf" ];
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
ignorePatterns = [
"&:[bf]g:c:clear:history:exit:q:pwd:* --help"
];
};
};
};
fonts = {
fontconfig = {
enable = true;
defaultFonts = {
serif = [ "Vazirmatn" ];
sansSerif = [ "Vazirmatn" ];
monospace = [ "Inconsolata Nerd Font Mono" ];
};
};
};
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
".config/hypr" = {
source = ./hypr;
recursive = true;
};
".config/kitty" = {
source = ./kitty;
recursive = true;
};
".config/nvim" = {
source = ./nvim;
recursive = true;
};
".config/waybar" = {
source = ./waybar;
recursive = true;
};
".config/fuzzel" = {
source = ./fuzzel;
recursive = true;
};
".config/dunst" = {
source = ./dunst;
recursive = true;
};
".config/lsd" = {
source = ./lsd;
recursive = true;
};
".config/bat" = {
source = ./bat;
recursive = true;
};
".npmrc" = {
source = ./npmrc;
};
".local/share/zsh/custom/themes/typewritten" = {
source = ./typewritten;
recursive = true;
};
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/karimi/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
T_QPA_PLATFORM = "wayland";
GDK_BACKEND = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
};
systemd = {
user = {
timers = {
battery-warning = {
Install = {
WantedBy = [ "timers.target" ];
};
Timer = {
Unit = "battery-warning.service";
OnBootSec = "1m";
OnUnitActiveSec = "1m";
};
};
};
services = {
battery-warning = {
Service = {
Type = "oneshot";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
ExecStart = toString (
pkgs.writeShellScript "battery-warning-script" ''
set -eu
STATUS=$(cat /sys/class/power_supply/BAT0/status)
CURRENT_CAPACITY=$(cat /sys/class/power_supply/BAT0/capacity)
if [ "$STATUS" == "Discharging" ]; then
if [ "$CURRENT_CAPACITY" -gt 22 ] && [ "$CURRENT_CAPACITY" -lt 26 ]; then
dunstify -a system -t 9000 -r 9990 -u normal "Battery Running Low" "$CURRENT_CAPACITY% Remaining"
elif [ "$CURRENT_CAPACITY" -gt 12 ] && [ "$CURRENT_CAPACITY" -lt 16 ]; then
dunstify -a system -t 9000 -r 9990 -u critical "Low Battery: $CURRENT_CAPACITY%" "Connect charger\nWill Hibernate soon"
elif [ "$CURRENT_CAPACITY" -lt 11 ]; then
dunstify -a system -t 0 -r 9990 -u critical "Battery Critically Low" "$CURRENT_CAPACITY% Remaining."
fi
fi
''
);
};
};
polkit-gnome-authentication-agent-1 = {
Unit = {
Description = "polkit-gnome-authentication-agent-1";
After = [ "graphical-session.target" ];
Wants = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" "default.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
};
};
wayland = {
windowManager = {
hyprland = {
enable = true;
extraConfig = (builtins.readFile hypr/hyprland.conf);
systemd.enable = true;
xwayland = {
enable = true;
};
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
};
};
};
services = {
blueman-applet = {
enable = true;
};
hyprpaper = {
enable = true;
settings = {
preload = "~/.config/hypr/assets/dark-cat-rosewater.png";
wallpaper = ",~/.config/hypr/assets/dark-cat-rosewater.png";
};
};
hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
};
listener = [
{
timeout = 150; # 2.5min.
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
{
timeout = 150; # 2.5min.
on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; # turn off keyboard backlight.
on-resume = "brightnessctl -rd rgb:kbd_backlight"; # turn on keyboard backlight.
}
{
timeout = 300; # 5min
on-timeout = "loginctl lock-session"; # lock screen when timeout has passed
}
{
timeout = 330; # 5.5min
on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
}];
};
};
};
programs = {
hyprlock = {
enable = true;
};
git = {
enable = true;
userName = "Muhammed Hussein Karimi";
userEmail = "[email protected]";
extraConfig = {
safe.directory = "/etc/*";
color = {
ui = "auto";
};
color.branch = {
current = "cyan bold reverse";
local = "white";
plain = "";
remote = "cyan";
};
color.diff = {
commit = "";
func = "cyan";
plain = "";
whitespace = "magenta reverse";
meta = "white";
frag = "cyan bold reverse";
old = "red";
new = "green";
};
color.grep = {
context = "";
filename = "";
function = "";
linenumber = "white";
match = "";
selected = "";
separator = "";
};
color.interactive = {
error = "";
header = "";
help = "";
prompt = "";
};
color.status = {
added = "green";
changed = "yellow";
header = "";
localBranch = "";
nobranch = "";
remoteBranch = "cyan bold";
unmerged = "magenta bold reverse";
untracked = "red";
updated = "green bold";
};
};
};
kitty = {
enable = true;
};
home-manager = {
enable = true;
};
};
}