Kieran's opinionated (and probably slightly dumb) nix config
1{
2 lib,
3 config,
4 pkgs,
5 ...
6}:
7{
8 options.atelier.shell.git.enable = lib.mkEnableOption {
9 description = "Enable global Git configuration";
10 };
11 config = lib.mkIf config.atelier.shell.git.enable {
12 programs.git = {
13 enable = true;
14 userName = "Kieran Klukas";
15 userEmail = "me@dunkirk.sh";
16 aliases = {
17 c = "commit";
18 p = "push";
19 ch = "checkout";
20 pushfwl = "push --force-with-lease --force-if-includes";
21 };
22 includes = [
23 {
24 path = pkgs.writeText "git-user-config" ''
25 [user]
26 name = Kieran Klukas
27 email = kieranklukas@cedarville.edu
28 signingKey = ~/.ssh/id_ed25519_cedarville.pub
29 [core]
30 sshCommand = ssh -i ~/.ssh/id_ed25519_cedarville
31 '';
32 condition = "gitdir:~/code/school/";
33 }
34 ];
35 extraConfig = {
36 branch.sort = "-committerdate";
37 pager.branch = false;
38 column.ui = "auto";
39 commit.gpgsign = true;
40 gpg.format = "ssh";
41 gpg.ssh.allowedSignersFile = "~/.ssh/allowedSigners";
42 user.signingKey = "~/.ssh/id_rsa.pub";
43 pull.rebase = true;
44 push.autoSetupRemote = true;
45 init.defaultBranch = "main";
46 };
47 delta.enable = true;
48 };
49 programs.gh.enable = true;
50 programs.lazygit = {
51 enable = true;
52 settings = {
53 gui.theme = {
54 lightTheme = false;
55 activeBorderColor = [
56 "blue"
57 "bold"
58 ];
59 inactiveBorderColor = [ "black" ];
60 selectedLineBgColor = [ "default" ];
61 };
62 };
63 };
64 programs.gh-dash = {
65 enable = true;
66 settings = {
67 prSections = [
68 {
69 title = "Mine";
70 filters = "is:open author:@me updated:>={{ nowModify \"-3w\" }} sort:updated-desc archived:false";
71 layout.author.hidden = true;
72 }
73 {
74 title = "Review";
75 filters = "sort:updated-desc is:pr is:open review-requested:taciturnaxolotl archived:false";
76 }
77 {
78 title = "All";
79 filters = "sort:updated-desc is:pr is:open user:@me archived:false";
80 }
81 ];
82 issuesSections = [
83 {
84 title = "Open";
85 filters = "user:@me is:open archived:false -author:@me sort:updated-desc";
86 }
87 {
88 title = "Assigned";
89 filters = "is:issue state:open archived:false assignee:@me sort:updated-desc ";
90 }
91 {
92 title = "Creator";
93 filters = "author:@me is:open archived:false";
94 }
95 {
96 title = "Hackclub";
97 filters = "is:issue org:hackclub archived:false involves:@me sort:updated-desc is:open";
98 }
99 {
100 title = "All";
101 filters = "is:issue involves:@me archived:false sort:updated-desc is:open";
102 }
103 ];
104 pager.diff = "diffnav";
105 defaults = {
106 view = "prs";
107 refetchIntervalMinutes = 5;
108 layout.prs = {
109 repoName = {
110 grow = true;
111 width = 10;
112 hidden = false;
113 };
114 base.hidden = true;
115 };
116 preview = {
117 open = true;
118 width = 84;
119 };
120 prsLimit = 20;
121 issuesLimit = 20;
122 };
123 repoPaths = {
124 "taciturnaxolotl/*" = "~/code/personal/*";
125 "hackclub/*" = "~/code/hackclub/*";
126 };
127 keybindings = {
128 universal = [
129 {
130 key = "g";
131 name = "lazygit";
132 command = "cd {{.RepoPath}} && lazygit";
133 }
134 ];
135 prs = [
136 {
137 key = "O";
138 builtin = "checkout";
139 }
140 {
141 key = "m";
142 command = "gh pr merge --admin --repo {{.RepoName}} {{.PrNumber}}";
143 }
144 {
145 key = "C";
146 name = "code review";
147 command = "tmux new-window -c {{.RepoPath}} 'nvim -c \":silent Octo pr edit {{.PrNumber}}\"'";
148 }
149 {
150 key = "a";
151 name = "lazygit add";
152 command = "cd {{.RepoPath}} && git add -A && lazygit";
153 }
154 {
155 key = "v";
156 name = "approve";
157 command = "gh pr review --repo {{.RepoName}} --approve --body \"$(gum input --prompt='Approval Comment: ')\" {{.PrNumber}}";
158 }
159 ];
160 };
161 theme = {
162 ui = {
163 sectionsShowCount = true;
164 table.compact = false;
165 };
166 };
167 };
168 };
169 };
170}