{ lib, config, pkgs, inputs, ... }: with lib; let cfg = config.modules.cli.git; in { options.modules.cli.git = { enable = mkEnableOption "enable git"; userName = mkOption { type = types.str; default = "Yorick Barbanneau"; description = "git username"; }; userEmail = mkOption { type = types.str; default = inputs.nix-private.git.personal.userEmail; description = "git email"; }; signingKey = mkOption { type = types.nullOr types.str; default = inputs.nix-private.git.personal.signingKey; description = "signing key fingerprint"; }; signByDefault = mkOption { type = types.bool; default = true; description = "activate signing by default"; }; }; config = mkIf cfg.enable { programs.git = { enable = true; delta = { enable = true; options = { dark = true; line-numbers = true; syntax-theme = "base16-256"; }; }; package = pkgs.gitFull; userName = "${cfg.userName}"; userEmail = "${cfg.userEmail}"; signing.key = cfg.signingKey; signing.signByDefault = cfg.signByDefault; aliases = { co = "checkout"; fa = "fetch --all"; far = "!git fa; git rebase"; l = "log --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(dim white)<%an>%Creset'"; la = "l --all"; lg = "log --graph --abbrev-commit --decorate --format=format:'%C(red)%h%C(reset) ┬ %C(cyan)%aD%C(reset) %C(green)(%ar)%C(reset)%C(yellow)%d%C(reset) %C(dim white) <%an>%C(reset)%n'' └─ %C(white)%s%C(reset)'"; lga = "lg --all"; pf = "push --force-with-lease"; rewrite = "!git commit --amend --no-edit && git push --force-with-lease"; st = "status -sb"; }; extraConfig = { core = { abbrev = 8; }; push = { autoSetupRemote = true; default = "current"; }; diff = { algorithm = "histogram"; colorMoved = "plain"; mnemonicPrefix = true; renames = true; }; commit.verbose = true; }; }; }; }