{ pkgs, lib, config, ... }: let cfg = config.py.programs.git; in { options.py.programs.git = { enable = lib.mkEnableOption "git configuration"; lazygit.enable = lib.mkEnableOption "lazygit configuration"; gh.enable = lib.mkEnableOption "gh configuration"; }; config = { catppuccin = { lazygit.enable = cfg.lazygit.enable; }; programs = { git = lib.mkIf cfg.enable { enable = true; package = pkgs.git; settings = { branch.sort = "-committerdate"; column.ui = "auto"; core.editor = lib.getExe pkgs.neovim; "credential \"https://git.pyrox.dev\"".username = "pyrox"; credential.helper = "rbw"; diff = { algorithm = "histogram"; colorMoved = "plain"; mnemonicPrefix = true; renames = true; }; fetch = { all = true; prune = true; pruneTags = true; }; gpg.ssh.allowedSignersFile = "~/.ssh/authorized_signatures"; init.defaultBranch = "main"; pull.rebase = false; push = { autoSetupRemote = true; followTags = true; }; rebase.updateRefs = true; tag.sort = "version:refname"; lfs = { enable = true; skipSmudge = false; }; user = { email = "pyrox@pyrox.dev"; name = "dish"; }; signing = { key = "~/.ssh/main.pub"; format = "ssh"; signByDefault = true; }; }; }; delta = { enable = true; options.line-numbers = true; enableGitIntegration = true; }; mergiraf = lib.mkIf cfg.enable { enable = true; }; lazygit = lib.mkIf cfg.lazygit.enable { enable = true; settings = { gui = { nerdFontsVersion = "3"; showRandomTip = false; theme.selectedLineBgColor = [ "default" ]; }; git.paging = { pager = "${lib.getExe pkgs.delta} --dark --paging=never"; colorArg = "always"; }; services = { "git.pyrox.dev" = "gitea:git.pyrox.dev"; "git.dn42.dev" = "gitea:git.dn42.dev"; "codeberg.org" = "gitea:codeberg.org"; }; }; }; gh = lib.mkIf cfg.gh.enable { enable = true; gitCredentialHelper.enable = true; settings = { editor = lib.getExe pkgs.neovim; git_protocol = "https"; browser = lib.mkIf config.py.profiles.gui.enable pkgs.firefox; prompt = "enabled"; }; }; }; }; }