Home

dotnix @e9d9c681867986f0890ba47c421793c1ea06785f - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / apps / nogui / git.nix
- raw
 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
{ pkgs, config, ... }:
let
  insteadOf = prefix: domain: {
    "https://${domain}/".insteadOf = "${prefix}:";
    "git@${domain}:".insteadOf = "ssh:${prefix}:";
  };
  key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAUxLwkJOlalAHTdkbh+m49XTZGKDqWz1o/o8OLmtQdX";
  sshSigning = {
    user.signingkey = key;
    commit.gpgSign = true;
    tag.gpgSign = true;
    gpg = {
      format = "ssh";
      ssh.allowedSignersFile = "${pkgs.writeText "allowedSigners" "git@jolheiser.com ${key}"}";
    };
  };
in
{
  programs.git = {
    enable = true;
    userName = "jolheiser";
    userEmail = "git@jolheiser.com";
    aliases = {
      wt = "worktree";
      ci = "commit -s -S -m";
      ca = "commit --amend";
      pf = "push --force";
      br = "branch";
      aa = "add .";
      adog = "log --all --decorate --oneline --graph";
      poh = "push origin HEAD";
      cb = "checkout -b";
      fu = "fetch upstream";
      fo = "fetch origin";
      dh = "diff HEAD";
      unstage = "restore --staged";
      last = "log --show-signature --format=fuller --max-count=1 HEAD";
      tui = "!lazygit";
    };
    lfs.enable = true;
    ignores = [
      ".idea/"
      "result"
      "node_modules"
      "ve"
    ];
    extraConfig = {
      init.defaultBranch = "main";
      merge.conflictstyle = "zdiff3";
      diff.colorMoved = "default";
      core.editor = "hx";
      push = {
        sutoSetupRemote = true;
        default = "current";
        gpgSign = "if-asked";
      };
      rerere.enabled = true;
      pull.rebase = true;
      diff.algorithm = "histogram";
      merge.tool = "hx";
      url =
        insteadOf "jo" "git.jolheiser.com"
        // insteadOf "gh" "github.com"
        // insteadOf "jj" "git.jojodev.com"
        // insteadOf "gt" "gitea.com"
        // insteadOf "gl" "gitlab.com"
        // insteadOf "cb" "codeberg.org";
    } // sshSigning;
    difftastic = {
      enable = true;
    };
    includes = [ { inherit (config.age.secrets.git-send-email) path; } ];
  };
}