aboutsummaryrefslogtreecommitdiff
path: root/modules/git/default.nix
blob: cff3d9aa86ab80ee0644cd1ff912ce0d549667b4 (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
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
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.modules.git;
in
{
  options.modules.git = {
    enable = lib.mkEnableOption "git";
  };

  config = lib.mkIf cfg.enable {
    # home.packages = with pkgs; [
    # ];
    programs.git = {
      enable = true;
      package = pkgs.gitFull;
      userName = "Stefan Weigl-Bosker";
      userEmail = "stefan@s00.xyz";
      aliases = {
        co = "checkout";
        ri = "rebase -i";
        ag = "add -g";
        ac = "commit --ammend";
        pushf = "push --force-with-lease";
      };
      delta = {
        enable = true;
        options = {
          "syntax-theme" = "base16-256";
          navigate = true;
          dark = true;
        };
      };
      #      extraConfig = {};
      # hooks = {
      #    pre-commit = ;
      # };
      ignores = [
        "*.swp"
        "*.swo"
        "*.swf"
        "*~"
        "*.tmp"
        "Session.vim"
        ".envrc"
        ".direnv/"
        ".ignore/"
        ".cache/"
        "*.o"
        "*.a"
        "*.so"
        "*.ko"
        "*.lib"
        # "*.out"
        # "*.elf"
      ];
      signing = {
        signByDefault = true;
        # key = "7783298ECC2A778EAC7EF1C8C430A3B6C37610D1";
      };
      extraConfig = {
        init.defaultBranch = "main";
        merge.conflictStyle = "zdiff3";
        pull.rebase = true;
        push.autoSetupRemote = true;
        rebase = {
          autoSquash = true;
          updateRefs = true;
        };
        fetch = {
          prune = true;
          pruneTags = true;
          all = true;
        };
        url = {
          "ssh://git@s00.xyz:".insteadOf = "g:/";
          "ssh://git@github.com:sweiglbosker/".insteadOf = "gh:/";
          "ssh://git@github.com:".insteadOf = "gh:";
        };
      };
    };
  };
}