about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/git/default.nix
blob: 6680c598788ea4bcf5f625762d927115e124b775 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
  lib,
  config,
  ...
}: let
  gitIgnoreFile = ./git_ignore.git;
  gitTemplateFile = ./git_template.git;
in {
  programs.git = {
    enable = true;
    #package = pkgs.gitAndTools.gitFull; # TODO: for git send-email support
    aliases = import ./aliases.nix {inherit lib config;};
    extraConfig = {
      core = {
        excludesFile = "${gitIgnoreFile}";
      };
      rebase = {
        autoStash = true;
        autoSquash = true;
      };
      init = {
        defaultBranch = "prime";
      };
      user = {
        name = "Benedikt Peetz";
        email = "benedikt.peetz@b-peetz.de";
        # signingKey = "[is down below]";
      };
      help = {
        autocorrect = 5;
      };
      push = {
        gpgSign = "if-asked";
      };
      commit = {
        template = "${gitTemplateFile}";
      };
      diff = {
        colorMoved = "default";
        # Usually leads to better results
        algorithm = "patience";
        bin = {
          textconv = "hexdump -v -C";
        };
      };
      # Makes it a bit more readable
      blame = {
        coloring = "repeatedLines";
        markIgnoredLines = true;
        markUnblamables = true;
      };
      merge = {
        conflictstyle = "zdiff3";
      };
      url = {
        "git@codeberg.org:" = {
          insteadOf = "@cb:";
        };
        "https://codeberg.org/" = {
          insteadOf = "cb://";
        };

        "git@github.com:" = {
          insteadOf = "@gh:";
        };
        "https://github.com/" = {
          insteadOf = "gh://";
        };

        "git@gitlab.com:" = {
          insteadOf = "@gl:";
        };
        "https://gitlab.com/" = {
          insteadOf = "gl://";
        };
      };
    };
    delta = {
      enable = true;
      options = {
        decorations = {
          commit-decoration-style = "bold yellow box ul";
          file-decoration-style = "none";
          file-style = "bold yellow ul";
        };
        keep-plus-minus-markers = true;
        features = "decorations";
        whitespace-error-style = "22 reverse";
      };
    };
    signing = {
      key = "8321ED3A8DB999A51F3BF80FF2682914EA42DE26";
      signByDefault = true;
    };
  };
}