old
 1{
 2  config,
 3  lib,
 4  pkgs,
 5  myvars,
 6  ...
 7}: {
 8  # `programs.git` will generate the config file: ~/.config/git/config
 9  # to make git use this config file, `~/.gitconfig` should not exist!
10  #
11  #    https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
12  home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
13    rm -f ${config.home.homeDirectory}/.gitconfig
14  '';
15
16  programs.git = {
17    enable = true;
18    lfs.enable = true;
19
20    userName = myvars.userfullname;
21    userEmail = myvars.useremail;
22
23    extraConfig = {
24      init.defaultBranch = "main";
25      trim.bases = "develop,master,main"; # for git-trim
26      push.autoSetupRemote = true;
27      pull.rebase = true;
28
29      # replace https with ssh
30      url = {
31        "ssh://git@github.com/HPCesia" = {
32          insteadOf = "https://github.com/HPCesia";
33        };
34        "ssh://git@codeberg.org/HPCesia" = {
35          insteadOf = "https://codeberg.org/HPCesia";
36        };
37        "ssh://git@repo.hpcesia.com:2233/HPCesia" = {
38          insteadOf = "https://repo.hpcesia.com/HPCesia";
39        };
40      };
41    };
42
43    # A syntax-highlighting pager in Rust(2019 ~ Now)
44    delta = {
45      enable = true;
46      options = {
47        diff-so-fancy = true;
48        line-numbers = true;
49        true-color = "always";
50      };
51    };
52  };
53
54  programs.jujutsu = {
55    enable = true;
56    settings = {
57      user = {
58        name = myvars.userfullname;
59        email = myvars.useremail;
60      };
61      ui = {
62        editor = "hx";
63        diff-formatter = "delta";
64      };
65      merge-tools.delta.diff-expected-exit-codes = [0 1];
66    };
67  };
68}