{ config, lib, pkgs, ... }: { options.git.enableWork = lib.mkEnableOption "work machine"; config = { home.packages = with pkgs; [ git-crypt glab gh hut ]; home.sessionPath = [ ".git/safe/../../bin" ]; programs.git = { enable = true; package = pkgs.gitFull; signing = { signByDefault = true; key = if config.git.enableWork then "D1528E3A998AE4B59D43A4BC10149ACB3374B317" else "A8F362E2D8066895581AC014DD4BE5191E2153E0"; }; settings = { user.name = "Andrew Fontaine"; user.email = if config.git.enableWork then "afontaine@gitlab.com" else "andrew@afontaine.ca"; init.defaultBranch = "main"; gitlab.user = "afontaine"; github.user = "afontaine"; branch.autoSetupMerge = "always"; column.ui = "auto"; branch.sort = "-committerdate"; tag.sort = "version:refname"; merge.conflictstyle = "zdiff3"; diff = { algorithm = "histogram"; colorMoved = "plain"; mnemonicPrefix = true; renames = true; }; sendemail = { identity = if config.mail.enableWork then "gitlab" else "afontaine"; annotate = true; }; fetch = { prune = true; pruneTags = true; all = true; }; rebase = { autoSquash = true; autoStash = true; updateRefs = true; }; core.editor = "emacsclient -c"; pull.rebase = true; help.autocorrect = 5; commit.gpgsign = true; push.default = "current"; push.autoSetupRemote = true; aliases = { 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"; lg2 = "log --graph --pretty=format:'%h -%d %s (%cr) <%an> {%G?% GS% GK}' --abbrev-commit "; safe = "!mkdir -p .git/safe"; }; }; lfs.enable = true; ignores = [ "# Created by https://www.gitignore.io/api/vim,tags,linux,emacs,windows" "# Edit at https://www.gitignore.io/?templates=vim,tags,linux,emacs,windows" "" "### Emacs ###" "# -*- mode: gitignore; -*-" "*~" "#*#" "/.emacs.desktop" "/.emacs.desktop.lock" "*.elc" "auto-save-list" "tramp" ".#*" "" "# Org-mode" ".org-id-locations" "*_archive" "" "# flymake-mode" "*_flymake.*" "" "# eshell files" "/eshell/history" "/eshell/lastdir" "" "# elpa packages" "/elpa/" "" "# reftex files" "*.rel" "" "# AUCTeX auto folder" "/auto/" "" "# cask packages" ".cask/" "dist/" "" "# Flycheck" "flycheck_*.el" "" "# server auth directory" "/server/" "" "# projectiles files" ".projectile" "" "# directory configuration" ".dir-locals.el" "" "# network security" "/network-security.data" "" "" "### Linux ###" "" "# temporary files which can be created if a process still has a handle open of a deleted file" ".fuse_hidden*" "" "# KDE directory preferences" ".directory" "" "# Linux trash folder which might appear on any partition or disk" ".Trash-*" "" "# .nfs files are created when an open file is removed but is still being accessed" ".nfs*" "" "### Tags ###" "# Ignore tags created by etags, ctags, gtags (GNU global) and cscope" "TAGS" ".TAGS" "!TAGS/" "tags" ".tags" "!tags/" "gtags.files" "GTAGS" "GRTAGS" "GPATH" "GSYMS" "cscope.files" "cscope.out" "cscope.in.out" "cscope.po.out" "" "" "### Vim ###" "# Swap" "[._]*.s[a-v][a-z]" "[._]*.sw[a-p]" "[._]s[a-rt-v][a-z]" "[._]ss[a-gi-z]" "[._]sw[a-p]" "" "# Session" "Session.vim" "Sessionx.vim" "" "# Temporary" ".netrwhist" "" "# Auto-generated tag files" "" "# Persistent undo" "[._]*.un~" "" "# Coc configuration directory" ".vim" "" "### Windows ###" "# Windows thumbnail cache files" "Thumbs.db" "Thumbs.db:encryptable" "ehthumbs.db" "ehthumbs_vista.db" "" "# Dump file" "*.stackdump" "" "# Folder config file" "[Dd]esktop.ini" "" "# Recycle Bin used on file shares" "$RECYCLE.BIN/" "" "# Windows Installer files" "*.cab" "*.msi" "*.msix" "*.msm" "*.msp" "" "# Windows shortcuts" "*.lnk" "" "# End of https://www.gitignore.io/api/vim,tags,linux,emacs,windows" ]; }; }; }