-
Notifications
You must be signed in to change notification settings - Fork 3
/
home.nix
865 lines (806 loc) · 24.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
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
{ pkgs ? import ./default.nix { }, flake ? null, machine-name ? "void", home-manager ? null, isBarebones ? false }:
let
inherit (pkgs.hax) isDarwin isLinux isM1 isX86Mac;
inherit (pkgs.hax) docker_aliases kubernetes_aliases;
inherit (pkgs.hax) attrIf words;
firstName = "jacobi";
lastName = "petrucciani";
personalEmail = "[email protected]";
workEmail = "[email protected]";
medableEmail = "[email protected]";
onAws = builtins.getEnv "USER" == "ubuntu";
promptChar = if isDarwin then "ᛗ" else "ᛥ";
username =
if isDarwin then
firstName
else
(if onAws then "ubuntu" else firstName);
homeDirectory =
if isDarwin then
"/Users/${firstName}"
else
(if onAws then "/home/ubuntu" else "/home/${firstName}");
sessionVariables = {
BASH_SILENCE_DEPRECATION_WARNING = "1";
EDITOR = "nano";
GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh";
HISTCONTROL = "ignoreboth";
LESS = "-iR";
PAGER = "less";
# thanks google
USE_GKE_GCLOUD_AUTH_PLUGIN = "True";
};
optList = conditional: list: if conditional then list else [ ];
in
{
nixpkgs.overlays = import ./overlays.nix;
programs = {
home-manager.enable = true;
home-manager.path = "${home-manager}";
htop.enable = true;
dircolors.enable = true;
};
# broken manpages upstream, see: https://github.com/nix-community/home-manager/issues/3342
manual.manpages.enable = false;
home = {
inherit username homeDirectory sessionVariables;
stateVersion = "22.11";
packages = with pkgs;
lib.flatten [
bash-completion
bashInteractive
bat
bzip2
cacert
cachix
clolcat
coreutils-full
cowsay
curl
diffutils
dogdns
dos2unix
dyff
ed
erdtree
fd
figlet
file
fq
gawk
genpass
gitAndTools.delta
glow
gnugrep
gnumake
gnupg
gnused
gron
gum
gzip
htmlq
ivy
jq
just
libarchive
libnotify
loop
lsof
manix
mods
moreutils
nano
nanorc
netcat-gnu
nil
nix-info
nix-output-monitor
nix-prefetch-github
nix-prefetch-scripts
nix-tree
nix-update
nixd
nixfmt-rfc-style
nixpkgs-fmt
nixpkgs-review
# nixVersions.nix_2_25
lix
openssh
p7zip
patch
pigz
procps
pssh
re2c
rlwrap
ruff
scc
scrypt
shfmt
spacer
statix
time
uv
unzip
vale
watch
wget
which
xh
yank
yq-go
zip
# kubernetes
kubectl
kubectx
## thanks google
gke-gcloud-auth-plugin
# secrets
flake.inputs.agenix.packages.${pkgs.system}.default
# load in my custom checked pog scripts
(
writeShellScriptBin "machine-name" ''
echo "${machine-name}"
''
)
hms
aws_pog_scripts
curl_pog_scripts
docker_pog_scripts
ffmpeg_pog_scripts
gcp_pog_scripts
general_pog_scripts
github_pog_scripts
hax_pog_scripts
helm_pog_scripts
k8s_pog_scripts
nix_pog_scripts
ssh_pog_scripts
# lsps
(with nodePackages; [
# bash-language-server
dockerfile-language-server-nodejs
vscode-json-languageserver
yaml-language-server
# vlang
])
(optList (!isBarebones) [
docker-client
google-cloud-sdk
ripgrep
shellcheck
terraform-ls
# python
(python312.withPackages pkgs.hax.basePythonPackages)
# keef's stuff
hax.comma
# sounds
meme_sounds
# mac specific
(
optList isDarwin [
# lima
]
)
# all except old mac
(
optList (!isX86Mac) [
git-trim
]
)
# linux specific
(
optList isLinux [
gnutar # this breaks vscode server?
nixos-generators
binutils
bitwarden-cli
keybase
man-pages
ncdu
sampler
vtm
]
)
])
# overlays
nix_hash_unstable
nix_hash_jpetrucciani
nix_hash_medable
nix_hash_hex
nix_hash_pog
nixup
];
};
programs.less.enable = true;
programs.lesspipe.enable = true;
programs.lsd.enable = true;
programs.yt-dlp = {
enable = isLinux;
extraConfig = ''
--embed-thumbnail
--embed-metadata
--embed-subs
--sub-langs all
--downloader aria2c
--downloader-args aria2c:'-c -x8 -s8 -k1M'
'';
};
programs.bash = {
inherit sessionVariables;
enable = true;
historyFileSize = -1;
historySize = -1;
shellAliases = {
ls = "ls --color=auto";
l = "lsd -lA --permission octal";
ll = "ls -ahlFG";
mkdir = "mkdir -pv";
fzfp = "${pkgs.fzf}/bin/fzf --preview 'bat --style=numbers --color=always {}'";
strip = ''${pkgs.gnused}/bin/sed -E 's#^\s+|\s+$##g' '';
# git
g = "git";
ga = "git add -A .";
cm = "git commit -m ";
# misc
space = "du -Sh | sort -rh | head -10";
now = "date +%s";
uneek = "awk '!a[$0]++'";
} // docker_aliases // kubernetes_aliases;
bashrcExtra =
if isDarwin then ''
export PATH="$PATH:${homeDirectory}/.nix-profile/bin"
'' else "";
initExtra = ''
HISTCONTROL=ignoreboth
set +h
export PATH="$PATH:$HOME/.bin/"
export PATH="$PATH:$HOME/.npm/bin/"
# asdf and base nix
'' + (if isM1 then ''
export CONFIGURE_OPTS="--build aarch64-apple-darwin20"
''
else ""
) + (
if isDarwin then ''
# add brew to path
brew_path="/opt/homebrew/bin/brew"
if [ -f /usr/local/bin/brew ]; then
brew_path="/usr/local/bin/brew"
fi
eval "$($brew_path shellenv)"
# load asdf if its there
asdf_dir="$(brew --prefix asdf)"
[[ -e "$asdf_dir/asdf.sh" ]] && source "$asdf_dir/asdf.sh"
[[ -e "$asdf_dir/etc/bash_completion.d/asdf.bash" ]] && source "$asdf_dir/etc/bash_completion.d/asdf.bash"
'' else ''
[[ -e $HOME/.asdf/asdf.sh ]] && source $HOME/.asdf/asdf.sh
[[ -e $HOME/.asdf/completions/asdf.bash ]] && source $HOME/.asdf/completions/asdf.bash
''
) + ''
_kube_contexts() {
local curr_arg;
curr_arg=''${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "- $(${pkgs.kubectl}/bin/kubectl config get-contexts --output='name')" -- $curr_arg ) );
}
_kube_namespaces() {
local curr_arg;
curr_arg=''${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "- $(${pkgs.kubectl}/bin/kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}')" -- $curr_arg ) );
}
# additional aliases
[[ -e ~/.aliases ]] && source ~/.aliases
# bash completions
export XDG_DATA_DIRS="$HOME/.nix-profile/share:''${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
source <(${pkgs.kubectl}/bin/kubectl completion bash)
source ~/.nix-profile/etc/profile.d/bash_completion.sh
source ~/.nix-profile/share/bash-completion/completions/git
source ~/.nix-profile/share/bash-completion/completions/ssh
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main g
complete -F __start_kubectl k
complete -F _kube_contexts kubectx kx
complete -F _kube_namespaces kubens kns
'' + (if (!isBarebones) then ''
source ~/.nix-profile/share/bash-completion/completions/docker
complete -F _docker d
'' else "") +
''
# there are often duplicate path entries on non-nixos; remove them
NEWPATH=
OLDIFS=$IFS
IFS=:
for entry in $PATH;do
if [[ ! :$NEWPATH: == *:$entry:* ]];then
if [[ -z $NEWPATH ]];then
NEWPATH=$entry
else
NEWPATH=$NEWPATH:$entry
fi
fi
done
IFS=$OLDIFS
export PATH="$NEWPATH"
unset OLDIFS NEWPATH
'' + (if isLinux then ''
${pkgs.figlet}/bin/figlet "$(hostname)" | ${pkgs.clolcat}/bin/clolcat
echo
'' else "");
};
programs.broot = {
enable = true;
enableBashIntegration = true;
};
programs.zoxide = {
enable = true;
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.nushell = {
enable = true;
};
programs.readline = {
enable = true;
variables = {
show-all-if-ambiguous = true;
skip-completed-text = true;
completion-query-items = -1;
expand-tilde = false;
bell-style = false;
revert-all-at-newline = true;
};
bindings = {
"\\e[1;5D" = "backward-word";
"\\e[1;5C" = "forward-word";
"\\e[5D" = "backward-word";
"\\e[5C" = "forward-word";
"\\e\\e[D" = "backward-word";
"\\e\\e[C" = "forward-word";
"\\C-k" = "kill-whole-line";
"\\C-p" = "history-search-backward";
"\\C-l" = "complete";
"\\C-f" = "complete-filename";
};
};
programs.helix = {
enable = true;
settings = {
# theme = "base16";
editor = {
lsp.display-messages = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
};
keys.normal = {
space = {
space = "file_picker";
w = ":w";
q = ":q";
};
};
};
};
programs.mcfly = {
enable = true;
enableBashIntegration = true;
};
programs.fzf = {
enable = true;
enableBashIntegration = false;
defaultCommand = "fd -tf -c always -H --ignore-file ${./ignore} -E .git";
defaultOptions = words "--ansi --reverse --multi --filepath-word";
};
programs.nnn = {
enable = true;
};
programs.ssh = {
enable = true;
compression = true;
includes = [ "config.d/*" ];
extraConfig = ''
User jacobi
PasswordAuthentication no
IdentitiesOnly yes
# secure stuff
KexAlgorithms curve25519-sha256,[email protected],diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
HostKeyAlgorithms ssh-ed25519,rsa-sha2-256,rsa-sha2-512
'';
};
home.file = {
ssh_config_github = {
target = ".ssh/config.d/github";
text = pkgs.hax.ssh.github;
};
curlrc = {
target = ".curlrc";
text = ''
--netrc-optional
'';
};
sqliterc = {
target = ".sqliterc";
text = ''
.output /dev/null
.headers on
.mode column
.prompt "> " ". "
.separator ROW "\n"
.nullvalue NULL
.output stdout
'';
};
prettier_config = {
target = "prettier.config.js";
text = builtins.readFile ./prettier.config.js;
};
${attrIf isLinux "gpgconf"} = {
target = ".gnupg/gpg.conf";
text = ''
use-agent
pinentry-mode loopback
'';
};
${attrIf isLinux "gpgagentconf"} = {
target = ".gnupg/gpg-agent.conf";
text = ''
allow-loopback-pinentry
'';
};
${attrIf isDarwin "gpgagentconf"} = {
target = ".gnupg/gpg-agent.conf";
text = ''
pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
'';
};
${attrIf false "vscodeserver"} = {
target = ".vscode-server/data/Machine/settings.json";
text =
let
# options
formatOnSave = "editor.formatOnSave";
formatter = "editor.defaultFormatter";
tabSize = "editor.tabSize";
# vscode extensions
extensions = {
elixir-ls = "JakeBecker.elixir-ls";
nixpkgs-fmt = "B4dM4n.nixpkgs-fmt";
nix-ide = "jnoortheen.nix-ide";
prettier = "esbenp.prettier-vscode";
python = "ms-python.python";
rust = "statiolake.vscode-rustfmt";
shell-format = "foxundermoon.shell-format";
terraform = "hashicorp.terraform";
};
nix-bin = "${homeDirectory}/.nix-profile/bin";
in
''
{
"telemetry.telemetryLevel": "off",
"${formatOnSave}": true,
"${formatter}": "${extensions.prettier}",
"python.formatting.blackPath": "${nix-bin}/black",
"python.linting.mypyPath": "${nix-bin}/mypy",
"python.linting.mypyEnabled": true,
"python.linting.flake8Args": ["--max-line-length=120", "--ignore=W503,W605"],
"python.languageServer": "Pylance",
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingImports": "none",
"reportInvalidStringEscapeSequence": "none"
},
"python.formatting.provider": "black",
"ruff.path": ["${nix-bin}/ruff"],
"prettier.configPath": "${homeDirectory}/prettier.config.js",
"nix.enableLanguageServer": true,
"nix.serverPath": "${nix-bin}/nil",
"nix.serverSettings": {
"nil": {
"diagnostics": {
"ignored": ["unused_binding", "unused_with"]
},
"formatting": {
"command": ["nixpkgs-fmt"]
}
}
},
"nixEnvSelector.nixFile": "''${workspaceRoot}/default.nix",
"[nix]": {
"${formatter}": "${extensions.nix-ide}",
"${tabSize}": 2
},
"[terraform]": {
"${formatter}": "${extensions.terraform}",
"${formatOnSave}": true,
"${tabSize}": 2
},
"[json]": {
"${formatter}": "${extensions.prettier}",
"${formatOnSave}": true,
"${tabSize}": 2
},
"[jsonc]": {
"${formatter}": "${extensions.prettier}",
"${formatOnSave}": true,
"${tabSize}": 2
},
"[haskell]": {
"${formatter}": "haskell.haskell",
"${formatOnSave}": true
},
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"[dockerfile]": { "${formatter}": "${extensions.prettier}" },
"[elixir]": {"${formatter}": "${extensions.elixir-ls}"},
"[ignore]": { "${formatter}": "${extensions.shell-format}" },
"[properties]": { "${formatter}": "${extensions.shell-format}" },
"[python]": {"${formatter}": "${extensions.python}"},
"[rust]": { "${formatter}": "${extensions.rust}" },
"[shellscript]": { "${formatter}": "${extensions.shell-format}" },
"[typescript]": {"${formatter}": "${extensions.prettier}"},
"[typescriptreact]": {"${formatter}": "${extensions.prettier}"},
"terraform.languageServer.enable": true,
"terraform.languageServer.args": ["serve"],
"terraform.languageServer.ignoreSingleFileWarning": false,
"terraform.languageServer.path": "${nix-bin}/terraform-ls",
"zircon.shell": "${nix-bin}/bash",
"shellformat.path": "${nix-bin}/shfmt",
"terminal.integrated.allowChords": false,
"autoDocstring.docstringFormat": "google-notypes",
"files.exclude": {
".git": true,
"**/.terraform": true,
"**/.git": true,
"**/__pycache__": true,
"**/.mypy_cache": true,
"**/.ruff_cache": true,
"**/.direnv": true,
"**/.db": true,
"**/.pytest_cache": true
},
"search.exclude": {
".git": true,
"**/.terraform": true,
"**/.git": true,
"**/__pycache__": true,
"**/.mypy_cache": true,
"**/.ruff_cache": true,
"**/.direnv": true,
"**/.db": true,
"**/.pytest_cache": true
}
}
'';
};
};
# starship config
programs.starship = {
enable = true;
settings = {
add_newline = false;
character = {
success_symbol = "[${promptChar}](bright-green)";
error_symbol = "[${promptChar}](bright-red)";
};
golang = {
style = "fg:#00ADD8";
symbol = "go ";
};
directory.style = "fg:#d442f5";
localip = {
disabled = true;
};
nix_shell = {
pure_msg = "";
impure_msg = "";
format = "via [$symbol$state($name)]($style) ";
};
kubernetes = {
disabled = false;
style = "fg:#326ce5";
};
terraform = {
disabled = false;
format = "via [$symbol $version]($style) ";
symbol = "🌴";
};
nodejs = { symbol = "⬡ "; };
hostname = {
style = "bold fg:46";
};
username = {
style_user = "bold fg:93";
};
# disabled plugins
aws.disabled = true;
battery.disabled = true;
cmd_duration.disabled = false;
gcloud.disabled = true;
package.disabled = true;
};
};
# gitconfig
programs.git =
let
gs = text:
let
script = pkgs.writers.writeBash "git-script" ''
set -eo pipefail
cd -- ''${GIT_PREFIX:-.}
${text}
'';
in
"! ${script}";
in
{
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "${firstName} ${lastName}";
userEmail =
if machine-name == "m1max" then medableEmail
else if machine-name == "edge" then workEmail
else personalEmail;
aliases = {
A = "add -A";
pu = "pull";
pur = "pull --rebase";
cam = "commit -am";
ca = "commit -a";
cm = "commit -m";
ci = "commit";
co = "checkout";
cod = gs ''git co $(git default) "$@"'';
st = "status";
br = gs ''
esc=$'\e'
reset=$esc[0m
red=$esc[31m
yellow=$esc[33m
green=$esc[32m
git -c color.ui=always branch -vv "$@" | ${pkgs.gnused}/bin/sed -E \
-e "s/: (gone)]/: $red\1$reset]/" \
-e "s/[:,] (ahead [0-9]*)([],])/: $green\1$reset\2/g" \
-e "s/[:,] (behind [0-9]*)([],])/: $yellow\1$reset\2/g"
git --no-pager stash list
'';
brf = gs "git f --quiet && git br";
f = "fetch --all";
hide = "update-index --skip-worktree";
unhide = "update-index --no-skip-worktree";
hidden = "! git ls-files -v | grep '^S' | cut -c3-";
branch-name = "!git rev-parse --abbrev-ref HEAD";
default = gs "git symbolic-ref refs/remotes/origin/HEAD | sed s@refs/remotes/origin/@@";
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)";
# Push current branch
put = gs ''git push "$@"'';
# Pull without merging
get = "!git pull origin $(git branch-name) --ff-only";
# update a branch without checkout
gd = gs "git fetch origin $(git default):$(git default)";
# Pull Master without switching branches
got =
"!f() { CURRENT_BRANCH=$(git branch-name) && git checkout $1 && git pull origin $1 --ff-only && git checkout $CURRENT_BRANCH; }; f";
gone = gs ''git branch -vv | ${pkgs.gnused}/bin/sed -En "/: gone]/s/^..([^[:space:]]*)\s.*/\1/p"'';
# Recreate your local branch based on the remote branch
recreate = ''
!f() { [[ -n $@ ]] && git checkout master && git branch -D "$@" && git pull origin "$@":"$@" && git checkout "$@"; }; f'';
reset-submodule = "!git submodule update --init";
s = gs "git br && git -c color.status=always status | grep -E --color=never '^\\s\\S|:$' || true";
sl = "!git --no-pager log -n 15 --oneline --decorate";
sla = "log --oneline --decorate --graph --all";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
shake = "remote prune origin";
pop = "reset HEAD~1";
};
extraConfig = {
checkout.defaultRemote = "origin";
color.ui = true;
fetch.prune = true;
init.defaultBranch = "main";
pull.ff = "only";
push.default = "simple";
rebase.instructionFormat = "<%ae >%s";
core = {
editor = if isDarwin then "code --wait" else "nano";
pager = "delta --dark";
autocrlf = "input";
# hooksPath = "/dev/null";
};
push = {
autoSetupRemote = true;
};
trim.bases = "main,master";
delta = {
navigate = true;
line-numbers = true;
side-by-side = true;
line-numbers-left-format = "";
line-numbers-right-format = "│ ";
};
};
lfs.enable = true;
${attrIf (!isLinux) "signing"} = {
key = "03C0CBEA6EAB9258";
gpgPath = "gpg";
signByDefault = true;
};
};
programs.tmux = {
enable = true;
tmuxp.enable = false;
historyLimit = 500000;
shortcut = "a";
extraConfig = ''
set -g base-index 1
set -g pane-base-index 1
set -g status-keys vi
setw -g mode-keys vi
setw -g mouse on
setw -g monitor-activity on
# Moving between windows.
unbind [
unbind ]
bind -r [ select-window -t :-
bind -r ] select-window -t :+
# Pane resizing.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Maximize and restore a pane.
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# Log output to a text file on demand.
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# -- display -------------------------------------------------------------------
# tabs
set -g window-status-current-format "#[fg=black]#[bg=red] #I #[bg=brightblack]#[fg=brightwhite] #W#[fg=brightblack]#[bg=black]"
set -g window-status-format "#[fg=black]#[bg=yellow] #I #[bg=brightblack]#[fg=brightwhite] #W#[fg=brightblack]#[bg=black]"
# status bar
set-option -g status-position bottom
set-option -g status-justify left
set -g status-fg colour1
set -g status-bg colour0
set -g status-left ' '
set -g status-right '#(date +"%_I:%M")'
set-option -g set-titles on
#256 colors
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
#Don't auto remane windows
set-option -g allow-rename off
# Source config
unbind r
bind r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ."
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# allow fn+left/right
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
setw -g monitor-activity off
setw -g monitor-activity on
set-option -g bell-action none
'';
};
# fix vscode
imports =
if isLinux then [
"${flake.inputs.vscode-server}/modules/vscode-server/home.nix"
] else [ ];
${attrIf isLinux "services"}.vscode-server.enable = isLinux;
}