aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home/git.nix
blob: 85665ab20b626d8272cedb7537db087470faf916 (plain)
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
{ pkgs, ... }:

{
  programs.git = {
    enable = true;

    signing = if pkgs.stdenv.isDarwin then {
      key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCyUn5BfmAnd/6xi0X1mYF/+jPOmCS0bpNUePF55gCY";
      signByDefault = true;
    } else {
      signByDefault = false;
    };

    settings = {
      user = {
        name = "Simen A. W. Olsen";
        email = "hello@simenandre.no";
      };
      apply.whitespace = "fix";
      core = {
        trustctime = false;
        editor = "nvim";
        excludesfile = "~/.gitignore_global";
      };
      color.ui = "auto";
      "color \"branch\"" = {
        current = "yellow reverse";
        local = "yellow";
        remote = "green";
      };
      "color \"diff\"" = {
        meta = "yellow bold";
        frag = "magenta bold";
        old = "red";
        new = "green";
      };
      "color \"status\"" = {
        added = "yellow";
        changed = "green";
        untracked = "cyan";
      };
      diff.renames = "copies";
      help.autocorrect = 1;
      merge.log = true;
      init.defaultBranch = "main";
      push.autoSetupRemote = true;
      github.user = "simenandre";
      pull.rebase = true;
    } // (if pkgs.stdenv.isDarwin then {
      gpg.format = "ssh";
      "gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
      "url \"ssh://git@github.com/\"".insteadOf = "https://github.com/";
      commit.gpgsign = true;
    } else {});
  };
}