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