nix config
1{
2 #xdg.configFile = {
3 # "git/config".source = ./config;
4 # "git/ignore".source = ./ignore;
5 # "git/attributes".source = ./attributes;
6 #};
7
8 programs.lazygit.enable = true;
9
10 programs.git = {
11 enable = true;
12 userName = "Anish Lakhwara";
13 userEmail = "anish+git@lakhwara.com";
14 delta.enable = true;
15 # TODO enable signing
16
17 ignores = [
18 "*~"
19 "*.*~"
20 "\\#*"
21 ".\\#*"
22 "*.swp"
23 ".*.sw[a-z]"
24 "*.un~"
25 ".netrwhist"
26 ".vim/*"
27 ".DS_Store?"
28 ".DS_Store"
29 ".CFUserTextEncoding"
30 ".Trash"
31 ".Xauthority"
32 "thumbs.db"
33 "Thumbs.db"
34 "Icon?"
35 ".ccls-cache/"
36 ".sass-cache/"
37 "__pycache__/"
38 "*.class"
39 "*.exe"
40 "*.o"
41 "*.pyc"
42 "*.elc"
43 ".nrepl-port"
44 ".envrc"
45 ".lsp/*"
46 ".direnv/*"
47 ".clj-kondo/*"
48 ".cpcache/*"
49 ".tmp"
50 ".direnv"
51 "result"
52 "node_modules/"
53 ];
54
55 extraConfig = {
56 pull.rebase = false;
57 push.autoSetupRemote = true;
58 init.defaultBranch = "main";
59 "url \"git@github.com:\"" = { insteadOf = "https://github.com/"; };
60 };
61
62 aliases = {
63 a = "add -p";
64 co = "checkout";
65 cob = "checkout -b";
66 f = "fetch -p";
67 c = "commit -v";
68 p = "push";
69 ba = "branch -a";
70 bd = "branch -d";
71 bD = "branch -D";
72 d = "diff";
73 dc = "diff --cached";
74 ds = "diff --staged";
75 r = "restore";
76 rs = "restore --staged";
77 st = "status -sb";
78
79 # reset
80 soft = "reset --soft";
81 hard = "reset --hard";
82 s1ft = "soft HEAD~1";
83 h1rd = "hard HEAD~1";
84
85 # logging
86 lg =
87 "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
88 plog =
89 "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
90 tlog =
91 "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
92 rank = "shortlog -sn --no-merges";
93 authors = "authors | sort | uniq -c | sort -n";
94 ls = "log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all";
95
96 # delete merged branches
97 bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
98 undo = "!git reset HEAD~1 --mixed";
99 blm = "blame -w -C -C -C";
100 };
101 };
102}