{ config, lib, pkgs, ... }: let cfg = config.my.git; in { options.my.git = { email = lib.mkOption { type = lib.types.str; default = ""; }; }; config = { programs.git = { enable = true; package = pkgs.gitFull; includes = [ { condition = "gitdir:~/ag/"; contents = { user.email = "johannes.maier@active-group.de"; }; } ]; ignores = [ # (n)vim "*.swp" ".exrc" ".nvimrc" # Direnv ".direnv/" ".envrc" # macOS ".DS_Store" # Emacs: backup, auto-save, lock files, directory-local # variables "*~" "\\#*\\#" ".\\#*" ".dir-locals.el" # JetBrains IDEs ".idea/" # Any LSP client ".lsp/" ]; signing = { signByDefault = true; key = "~/.ssh/id_ed25519.pub"; }; settings = { user = { name = "Johannes Maier"; inherit (cfg) email; }; alias = { co = "checkout"; pushf = "push --force-with-lease"; }; branch.sort = "-committerdate"; column.sort = "auto"; core.askPass = ""; diff = { algorithm = "histogram"; mnemonicPrefix = true; renames = true; }; fetch = { prune = true; pruneTags = true; all = true; }; gpg.format = "ssh"; init.defaultBranch = "main"; merge.conflictstyle = "zdiff3"; pull.rebase = "true"; push.autoSetupRemote = "true"; rebase = { autoSquash = true; autoStash = true; updateRefs = true; }; submodule.recurse = "true"; tag.sort = "version:refname"; url = { "https://github.com/" = { insteadOf = "gh:"; }; "git@github.com:kenranunderscore/" = { insteadOf = "gh:/"; }; "ssh://git@codeberg.org/kenranunderscore/" = { insteadOf = "cb:/"; }; "git@github.com:" = { insteadOf = "ghssh:"; }; "https://gitlab.com/" = { insteadOf = "gl:"; }; "ssh://git@gitlab.active-group.de/ag/" = { insteadOf = "ag:"; }; "git@github.com:active-group/" = { insteadOf = "aggh:"; }; }; }; }; }; }