about summary refs log tree commit diff stats
path: root/home-manager/config/git/default.nix
blob: c01738e0a8360e08f3d1472706f9b85ccf84e11f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{...}: let
  gitConfig = {
    core = {
      excludesFile = "${gitIgnoreFile}";
    };
    init = {
      defaultBranch = "prime";
    };
    user = {
      email = "soispha@vhack.eu";
      name = "Soispha";
    };
    help = {
      autocorrect = 5;
    };
    commit = {
      template = "${gitTemplateFile}";
    };
  };
  gitIgnoreFile = ./git_ignore.git;
  gitTemplateFile = ./git_template.git;
in {
  programs.git = {
    enable = true;
    #package = pkgs.gitAndTools.gitFull; # TODO for git send-email support
    aliases = {
      st = "status";
      ds = "diff --staged";

      ## Logging:
      ls = "log --max-count=10 --color --format=format:'%C(bold red)%h%C(reset) %C(dim bold blue)%s%C(reset) %C(dim white)[%aN]' ";

      # https://stackoverflow.com/a/61487052
      lg = "lg1";
      lg1 = "lg1-specific --all";
      lg2 = "lg2-specific --all";
      lg3 = "lg3-specific --all";

      lg1-specific = "log --graph --abbrev-commit --decorate \
                      --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'";

      lg2-specific = "log --graph --abbrev-commit --decorate \
                      --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'";

      lg3-specific = "log --graph --abbrev-commit --decorate \
                      --format=format:'%C(bold blue)%h%C(reset)\
                      - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)\
                      %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n\
                      ''          %C(white)%s%C(reset)%n''   \
                      %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'";
    };
    extraConfig = gitConfig;
    delta = {
      enable = true;
      options = {
        decorations = {
          commit-decoration-style = "bold yellow box ul";
          file-decoration-style = "none";
          file-style = "bold yellow ul";
        };
        features = "decorations";
        whitespace-error-style = "22 reverse";
      };
    };
    signing = {
      key = "9606FC749FCE16360723D4ADA5E94010C3A642AD";
      signByDefault = true;
    };
  };
}
# vim: ts=2