forked from wimpysworld/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
545 lines (530 loc) · 16.7 KB
/
default.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
{ config, desktop, hostname, inputs, lib, outputs, pkgs, stateVersion, username, ... }:
let
inherit (pkgs.stdenv) isDarwin isLinux;
isLima = builtins.substring 0 5 hostname == "lima-";
isWorkstation = if (desktop != null) then true else false;
isStreamstation = if (hostname == "phasma" || hostname == "vader") then true else false;
in
{
imports = [
# If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Modules exported from other flakes:
inputs.sops-nix.homeManagerModules.sops
inputs.nix-index-database.hmModules.nix-index
]
++ lib.optional (builtins.pathExists (./. + "/_mixins/users/${username}")) ./_mixins/users/${username}
++ lib.optional (builtins.pathExists (./. + "/_mixins/hosts/${hostname}")) ./_mixins/hosts/${hostname}
++ lib.optional (isWorkstation) ./_mixins/desktop;
home = {
inherit stateVersion;
inherit username;
activation.report-changes = config.lib.dag.entryAnywhere ''
if [[ -n "$oldGenPath" && -n "$newGenPath" ]]; then
${pkgs.nvd}/bin/nvd diff $oldGenPath $newGenPath
fi
'';
homeDirectory = if isDarwin then "/Users/${username}" else if isLima then "/home/${username}.linux" else "/home/${username}";
file = {
"${config.xdg.configHome}/fastfetch/config.jsonc".text = builtins.readFile ./_mixins/configs/fastfetch.jsonc;
};
file = {
"${config.xdg.configHome}/yazi/keymap.toml".text = builtins.readFile ./_mixins/configs/yazi-keymap.toml;
};
file = {
"${config.xdg.configHome}/yazi/theme.toml".text = builtins.readFile ./_mixins/configs/yazi-theme.toml;
};
file = {
"${config.xdg.configHome}/halloy/themes/harmony-dark.yaml".text = builtins.readFile ./_mixins/configs/harmony-dark.yaml;
};
file = {
"${config.xdg.configHome}/fish/functions/build-home.fish".text = builtins.readFile ./_mixins/configs/build-home.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/switch-home.fish".text = builtins.readFile ./_mixins/configs/switch-home.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/help.fish".text = builtins.readFile ./_mixins/configs/help.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/h.fish".text = builtins.readFile ./_mixins/configs/h.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/lima-create.fish".text = builtins.readFile ./_mixins/configs/lima-create.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/gpg-restore.fish".text = builtins.readFile ./_mixins/configs/gpg-restore.fish;
};
file = {
"${config.xdg.configHome}/fish/functions/get-nix-hash.fish".text = builtins.readFile ./_mixins/configs/get-nix-hash.fish;
};
file = {
".hidden".text = ''snap'';
};
# A Modern Unix experience
# https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/
packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" "NerdFontsSymbolsOnly" ]; })
ubuntu_font_family
work-sans
asciicam # Terminal webcam
asciinema-agg # Convert asciinema to .gif
asciinema # Terminal recorder
bandwhich # Modern Unix `iftop`
bmon # Modern Unix `iftop`
breezy # Terminal bzr client
butler # Terminal Itch.io API client
chafa # Terminal image viewer
chroma # Code syntax highlighter
clinfo # Terminal OpenCL info
cpufetch # Terminal CPU info
croc # Terminal file transfer
curlie # Terminal HTTP client
dconf2nix # Nix code from Dconf files
difftastic # Modern Unix `diff`
dogdns # Modern Unix `dig`
dotacat # Modern Unix lolcat
dua # Modern Unix `du`
duf # Modern Unix `df`
du-dust # Modern Unix `du`
editorconfig-core-c # EditorConfig Core
entr # Modern Unix `watch`
fastfetch # Modern Unix system info
fd # Modern Unix `find`
frogmouth # Terminal mardown viewer
glow # Terminal Markdown renderer
gping # Modern Unix `ping`
h # Modern Unix autojump for git projects
hexyl # Modern Unix `hexedit`
hr # Terminal horizontal rule
httpie # Terminal HTTP client
hyperfine # Terminal benchmarking
iperf3 # Terminal network benchmarking
jpegoptim # Terminal JPEG optimizer
jiq # Modern Unix `jq`
lima-bin # Terminal VM manager
mdp # Terminal Markdown presenter
mtr # Modern Unix `traceroute`
neo-cowsay # Terminal ASCII cows
netdiscover # Modern Unix `arp`
nixpkgs-review # Nix code review
nix-prefetch-scripts # Nix code fetcher
nurl # Nix URL fetcher
nyancat # Terminal rainbow spewing feline
onefetch # Terminal git project info
optipng # Terminal PNG optimizer
procs # Modern Unix `ps`
quilt # Terminal patch manager
rclone # Modern Unix `rsync`
rsync # Traditional `rsync`
sd # Modern Unix `sed`
speedtest-go # Terminal speedtest.net
terminal-parrot # Terminal ASCII parrot
tldr # Modern Unix `man`
tokei # Modern Unix `wc` for code
ueberzugpp # Terminal image viewer integration
unzip # Terminal ZIP extractor
upterm # Terminal sharing
wget # Terminal HTTP client
wget2 # Terminal HTTP client
wthrr # Modern Unix weather
wormhole-william # Terminal file transfer
yq-go # Terminal `jq` for YAML
] ++ lib.optionals (isStreamstation) [
# Deckmaster and the utilities I bind to the Stream Deck
alsa-utils
bc
deckmaster
hueadm
notify-desktop
obs-cli
piper-tts
playerctl
pulsemixer
] ++ lib.optionals isLinux [
figlet # Terminal ASCII banners
iw # Terminal WiFi info
lurk # Modern Unix `strace`
pciutils # Terminal PCI info
psmisc # Traditional `ps`
ramfetch # Terminal system info
s-tui # Terminal CPU stress test
stress-ng # Terminal CPU stress test
usbutils # Terminal USB info
wavemon # Terminal WiFi monitor
writedisk # Modern Unix `dd`
zsync # Terminal file sync; FTBFS on aarch64-darwin
] ++ lib.optionals isDarwin [
m-cli # Terminal Swiss Army Knife for macOS
];
sessionVariables = {
EDITOR = "micro";
MANPAGER = "sh -c 'col --no-backspaces --spaces | bat --language man'";
MANROFFOPT = "-c";
PAGER = "bat";
SYSTEMD_EDITOR = "micro";
VISUAL = "micro";
};
};
fonts.fontconfig.enable = true;
# Workaround home-manager bug with flakes
# - https://github.com/nix-community/home-manager/issues/2033
news.display = "silent";
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# Add overlays exported from other flakes:
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
nix = {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
package = pkgs.unstable.nix;
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
netrc-file = "${config.home.homeDirectory}/.local/share/flakehub/netrc";
extra-trusted-substituters = "https://cache.flakehub.com/";
extra-trusted-public-keys = "cache.flakehub.com-1:t6986ugxCA+d/ZF9IeMzJkyqi5mDhvFIx7KA/ipulzE= cache.flakehub.com-2:ntBGiaKSmygJOw2j1hFS7KDlUHQWmZALvSJ9PxMJJYU=";
# Avoid unwanted garbage collection when using nix-direnv
keep-outputs = true;
keep-derivations = true;
warn-dirty = false;
};
};
programs = {
aria2.enable = true;
atuin = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
enableZshIntegration = true;
flags = [
"--disable-up-arrow"
];
package = pkgs.atuin;
settings = {
auto_sync = true;
dialect = "uk";
key_path = config.sops.secrets.atuin_key.path;
show_preview = true;
style = "compact";
sync_frequency = "1h";
sync_address = "https://api.atuin.sh";
update_check = false;
};
};
bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batgrep
batwatch
prettybat
];
config = {
style = "plain";
};
};
bottom = {
enable = true;
settings = {
colors = {
high_battery_color = "green";
medium_battery_color = "yellow";
low_battery_color = "red";
};
disk_filter = {
is_list_ignored = true;
list = [ "/dev/loop" ];
regex = true;
case_sensitive = false;
whole_word = false;
};
flags = {
dot_marker = false;
enable_gpu_memory = true;
group_processes = true;
hide_table_gap = true;
mem_as_value = true;
tree = true;
};
};
};
cava = {
enable = isLinux;
settings = {
color = {
gradient = 1;
gradient_count = 8;
gradient_color_1 = "'#59cc33'";
gradient_color_2 = "'#80cc33'";
gradient_color_3 = "'#a6cc33'";
gradient_color_4 = "'#cccc33'";
gradient_color_5 = "'#cca633'";
gradient_color_6 = "'#cc8033'";
gradient_color_7 = "'#cc5933'";
gradient_color_8 = "'#cc3333'";
};
};
};
dircolors = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
enableZshIntegration = true;
};
direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv = {
enable = true;
};
};
eza = {
enable = true;
enableAliases = true;
extraOptions = [
"--group-directories-first"
"--header"
];
git = true;
icons = true;
};
fish = {
enable = true;
shellAliases = {
banner = lib.mkIf isLinux "${pkgs.figlet}/bin/figlet";
banner-color = lib.mkIf isLinux "${pkgs.figlet}/bin/figlet $argv | ${pkgs.dotacat}/bin/dotacat";
brg = "${pkgs.bat-extras.batgrep}/bin/batgrep";
cat = "${pkgs.bat}/bin/bat --paging=never";
dadjoke = ''${pkgs.curlMinimal}/bin/curl --header "Accept: text/plain" https://icanhazdadjoke.com/'';
dmesg = "${pkgs.util-linux}/bin/dmesg --human --color=always";
neofetch = "${pkgs.fastfetch}/bin/fastfetch";
glow = "${pkgs.glow}/bin/glow --pager";
hr = ''${pkgs.hr}/bin/hr "─━"'';
htop = "${pkgs.bottom}/bin/btm --basic --tree --hide_table_gap --dot_marker --mem_as_value";
ip = "${pkgs.iproute2}/bin/ip --color --brief";
less = "${pkgs.bat}/bin/bat";
lolcat = "${pkgs.dotacat}/bin/dotacat";
make-lima-builder = "lima-create builder";
make-lima-default = "lima-create default";
moon = "${pkgs.curlMinimal}/bin/curl -s wttr.in/Moon";
more = "${pkgs.bat}/bin/bat";
checkip = "${pkgs.curlMinimal}/bin/curl -s ifconfig.me/ip";
parrot = "${pkgs.terminal-parrot}/bin/terminal-parrot -delay 50 -loops 7";
ruler = ''${pkgs.hr}/bin/hr "╭─³⁴⁵⁶⁷⁸─╮"'';
screenfetch = "${pkgs.fastfetch}/bin/fastfetch";
speedtest = "${pkgs.speedtest-go}/bin/speedtest-go";
store-path = "${pkgs.coreutils-full}/bin/readlink (${pkgs.which}/bin/which $argv)";
top = "${pkgs.bottom}/bin/btm --basic --tree --hide_table_gap --dot_marker --mem_as_value";
tree = "${pkgs.eza}/bin/eza --tree";
wormhole = "${pkgs.wormhole-william}/bin/wormhole-william";
weather = "${pkgs.wthrr}/bin/wthrr auto -u f,24h,c,mph -f d,w";
weather-home = "${pkgs.wthrr}/bin/wthrr basingstoke -u f,24h,c,mph -f d,w";
};
};
fzf = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
};
gh = {
enable = true;
extensions = with pkgs; [ gh-markdown-preview ];
settings = {
editor = "micro";
git_protocol = "ssh";
prompt = "enabled";
};
};
git = {
enable = true;
aliases = {
ci = "commit";
cl = "clone";
co = "checkout";
purr = "pull --rebase";
dlog = "!f() { GIT_EXTERNAL_DIFF=difft git log -p --ext-diff $@; }; f";
dshow = "!f() { GIT_EXTERNAL_DIFF=difft git show --ext-diff $@; }; f";
fucked = "reset --hard";
graph = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
};
difftastic = {
display = "side-by-side-show-both";
enable = true;
};
extraConfig = {
advice = {
statusHints = false;
};
color = {
branch = false;
diff = false;
interactive = true;
log = false;
status = true;
ui = false;
};
core = {
pager = "bat";
};
push = {
default = "matching";
};
pull = {
rebase = false;
};
init = {
defaultBranch = "main";
};
};
ignores = [
"*.log"
"*.out"
".DS_Store"
"bin/"
"dist/"
"result"
];
};
gitui = {
enable = true;
theme = ''
(
selected_tab: Reset,
command_fg: Black,
selection_bg: Blue,
selection_fg: White,
cmdbar_bg: Yellow,
cmdbar_extra_lines_bg: Yellow,
disabled_fg: DarkGray,
diff_line_add: Green,
diff_line_delete: Red,
diff_file_added: LightGreen,
diff_file_removed: LightRed,
diff_file_moved: LightMagenta,
diff_file_modified: Yellow,
commit_hash: Magenta,
commit_time: LightCyan,
commit_author: Green,
danger_fg: Red,
push_gauge_bg: Blue,
push_gauge_fg: Reset,
tag_fg: LightMagenta,
branch_fg: LightYellow,
)
'';
};
gpg.enable = true;
home-manager.enable = true;
info.enable = true;
jq.enable = true;
micro = {
enable = true;
settings = {
autosu = true;
colorscheme = "simple";
diffgutter = true;
paste = true;
rmtrailingws = true;
savecursor = true;
saveundo = true;
scrollbar = true;
scrollbarchar = "•";
scrollmargin = 4;
scrollspeed = 1;
};
};
nix-index.enable = true;
powerline-go = {
enable = true;
settings = {
cwd-max-depth = 5;
cwd-max-dir-size = 12;
max-width = 60;
};
};
ripgrep = {
arguments = [
"--colors=line:style:bold"
"--max-columns-preview"
"--smart-case"
];
enable = true;
};
yazi = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
enableZshIntegration = true;
package = pkgs.unstable.yazi;
settings = {
manager = {
show_hidden = false;
show_symlink = true;
sort_by = "natural";
sort_dir_first = true;
sort_sensitive = false;
sort_reverse = false;
};
};
};
yt-dlp = {
enable = true;
package = pkgs.unstable.yt-dlp;
settings ={
audio-format = "best";
audio-quality = 0;
embed-chapters = true;
embed-metadata = true;
embed-subs = true;
embed-thumbnail = true;
remux-video = "aac>m4a/mov>mp4/mkv";
sponsorblock-mark = "sponsor";
sub-langs = "all";
};
};
zoxide = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
enableZshIntegration = true;
# Replace cd with z and add cdi to access zi
options = [
"--cmd cd"
];
};
};
services = {
gpg-agent = {
enable = isLinux;
enableSshSupport = true;
pinentryFlavor = "curses";
};
};
# Nicely reload system units when changing configs
systemd.user.startServices = lib.mkIf isLinux "sd-switch";
xdg = {
enable = isLinux;
userDirs = {
enable = isLinux;
createDirectories = lib.mkDefault true;
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Pictures/Screenshots";
};
};
};
}