My collection of nix configurations
1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8{
9 options.git.enableWork = lib.mkEnableOption "work machine";
10 config = {
11 home.packages = with pkgs; [
12 git-crypt
13 glab
14 gh
15 hut
16 ];
17 home.sessionPath = [ ".git/safe/../../bin" ];
18 programs.git = {
19 enable = true;
20 package = pkgs.gitFull;
21 signing = {
22 signByDefault = true;
23 key =
24 if config.git.enableWork then
25 "D1528E3A998AE4B59D43A4BC10149ACB3374B317"
26 else
27 "A8F362E2D8066895581AC014DD4BE5191E2153E0";
28 };
29 settings = {
30 user.name = "Andrew Fontaine";
31 user.email = if config.git.enableWork then "afontaine@gitlab.com" else "andrew@afontaine.ca";
32 init.defaultBranch = "main";
33 gitlab.user = "afontaine";
34 github.user = "afontaine";
35 branch.autoSetupMerge = "always";
36 column.ui = "auto";
37 branch.sort = "-committerdate";
38 tag.sort = "version:refname";
39 merge.conflictstyle = "zdiff3";
40 diff = {
41 algorithm = "histogram";
42 colorMoved = "plain";
43 mnemonicPrefix = true;
44 renames = true;
45 };
46 sendemail = {
47 identity = if config.mail.enableWork then "gitlab" else "afontaine";
48 annotate = true;
49 };
50 fetch = {
51 prune = true;
52 pruneTags = true;
53 all = true;
54
55 };
56 rebase = {
57 autoSquash = true;
58 autoStash = true;
59 updateRefs = true;
60 };
61 core.editor = "emacsclient -c";
62 pull.rebase = true;
63 help.autocorrect = 5;
64 commit.gpgsign = true;
65 push.default = "current";
66 push.autoSetupRemote = true;
67 aliases = {
68 lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(dim magenta){%G?% GS% GK}%Creset' --abbrev-commit";
69 lg2 = "log --graph --pretty=format:'%h -%d %s (%cr) <%an> {%G?% GS% GK}' --abbrev-commit ";
70 safe = "!mkdir -p .git/safe";
71 };
72 };
73 lfs.enable = true;
74 ignores = [
75 "# Created by https://www.gitignore.io/api/vim,tags,linux,emacs,windows"
76 "# Edit at https://www.gitignore.io/?templates=vim,tags,linux,emacs,windows"
77 ""
78 "### Emacs ###"
79 "# -*- mode: gitignore; -*-"
80 "*~"
81 "#*#"
82 "/.emacs.desktop"
83 "/.emacs.desktop.lock"
84 "*.elc"
85 "auto-save-list"
86 "tramp"
87 ".#*"
88 ""
89 "# Org-mode"
90 ".org-id-locations"
91 "*_archive"
92 ""
93 "# flymake-mode"
94 "*_flymake.*"
95 ""
96 "# eshell files"
97 "/eshell/history"
98 "/eshell/lastdir"
99 ""
100 "# elpa packages"
101 "/elpa/"
102 ""
103 "# reftex files"
104 "*.rel"
105 ""
106 "# AUCTeX auto folder"
107 "/auto/"
108 ""
109 "# cask packages"
110 ".cask/"
111 "dist/"
112 ""
113 "# Flycheck"
114 "flycheck_*.el"
115 ""
116 "# server auth directory"
117 "/server/"
118 ""
119 "# projectiles files"
120 ".projectile"
121 ""
122 "# directory configuration"
123 ".dir-locals.el"
124 ""
125 "# network security"
126 "/network-security.data"
127 ""
128 ""
129 "### Linux ###"
130 ""
131 "# temporary files which can be created if a process still has a handle open of a deleted file"
132 ".fuse_hidden*"
133 ""
134 "# KDE directory preferences"
135 ".directory"
136 ""
137 "# Linux trash folder which might appear on any partition or disk"
138 ".Trash-*"
139 ""
140 "# .nfs files are created when an open file is removed but is still being accessed"
141 ".nfs*"
142 ""
143 "### Tags ###"
144 "# Ignore tags created by etags, ctags, gtags (GNU global) and cscope"
145 "TAGS"
146 ".TAGS"
147 "!TAGS/"
148 "tags"
149 ".tags"
150 "!tags/"
151 "gtags.files"
152 "GTAGS"
153 "GRTAGS"
154 "GPATH"
155 "GSYMS"
156 "cscope.files"
157 "cscope.out"
158 "cscope.in.out"
159 "cscope.po.out"
160 ""
161 ""
162 "### Vim ###"
163 "# Swap"
164 "[._]*.s[a-v][a-z]"
165 "[._]*.sw[a-p]"
166 "[._]s[a-rt-v][a-z]"
167 "[._]ss[a-gi-z]"
168 "[._]sw[a-p]"
169 ""
170 "# Session"
171 "Session.vim"
172 "Sessionx.vim"
173 ""
174 "# Temporary"
175 ".netrwhist"
176 ""
177 "# Auto-generated tag files"
178 ""
179 "# Persistent undo"
180 "[._]*.un~"
181 ""
182 "# Coc configuration directory"
183 ".vim"
184 ""
185 "### Windows ###"
186 "# Windows thumbnail cache files"
187 "Thumbs.db"
188 "Thumbs.db:encryptable"
189 "ehthumbs.db"
190 "ehthumbs_vista.db"
191 ""
192 "# Dump file"
193 "*.stackdump"
194 ""
195 "# Folder config file"
196 "[Dd]esktop.ini"
197 ""
198 "# Recycle Bin used on file shares"
199 "$RECYCLE.BIN/"
200 ""
201 "# Windows Installer files"
202 "*.cab"
203 "*.msi"
204 "*.msix"
205 "*.msm"
206 "*.msp"
207 ""
208 "# Windows shortcuts"
209 "*.lnk"
210 ""
211 "# End of https://www.gitignore.io/api/vim,tags,linux,emacs,windows"
212 ];
213 };
214 };
215}