]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/git.nix
nebula: sourcephile.fr: fix cert path
[julm/julm-nix.git] / home-manager / profiles / git.nix
1 { pkgs, lib, ... }:
2 {
3 home.packages = [
4 pkgs.b4
5 pkgs.delta
6 pkgs.difftastic
7 pkgs.git-absorb
8 pkgs.git-bug
9 pkgs.git-chglog
10 pkgs.git-cliff
11 pkgs.git-crypt
12 pkgs.git-extras
13 pkgs.git-filter-repo
14 #pkgs.git-publish
15 pkgs.git-quick-stats
16 pkgs.gitui
17 pkgs.tig
18 ];
19 programs.git = {
20 enable = true;
21 ignores = [ "*~" "*.swp" ];
22 package = lib.mkDefault pkgs.gitMinimal;
23 aliases = {
24 a = "add";
25 ab = "absorb";
26 abr = "absorb -r";
27 ap = "add -p";
28 au = "add -u";
29 authors = "shortlog -s -n";
30 b = "branch";
31 bl = "git log -p -M --follow --stat --";
32 c = "commit";
33 ca = "commit --amend";
34 caa = "commit --amend -C@";
35 caaa = "commit --amend -C@ -a";
36 cf = "commit --fixup";
37 co = "checkout";
38 d = "diff";
39 dc = "diff --cached";
40 dcw = "diff --cached --word-diff=color";
41 dh = "diff --histogram";
42 dp = "diff --patience";
43 dt = "difftool --patience";
44 dtc = "difftool --cached";
45 dw = "diff --word-diff=color";
46 g = "grep";
47 ign = "ls-files -o -i --exclude-standard";
48 l = "log";
49 ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
50 lp = "log -p --pretty=fuller";
51 lpg = "log -p --pretty=fuller -g";
52 p = "push -v";
53 pf = "push -vf";
54 pu = "pull";
55 r = "reset";
56 rh = "reset --hard";
57 ri = "rebase -i";
58 rp = "reset -p";
59 s = "status";
60 spull = "!git-svn fetch && git-svn rebase";
61 spush = "!git-svn dcommit";
62 ss = "status -s";
63 st = "status -uno";
64 sw = "switch";
65 fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
66 pull-local = "!git fetch-local && git checkout -B master local/master";
67 pull-local-old = "!git fetch-local && git checkout HEAD'^' && git branch -f master local/master && git checkout master";
68 root = ''!git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"'';
69 has-tag-version = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\(\\^{}\\)\\?\"'';
70 tag-version = ''"!git has-tag-version && return; v=$(TZ=UTC date +v%Y-%m-%d) && name=$(git rev-parse --show-toplevel | sed -e 's:^.*/work::') && set -x && git tag -s -m \"$name $v\" $v"'';
71 has-tag-majordate = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9]\\+.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\\(\\^{}\\)\\?\"'';
72 tag-majordate = ''"!git has-tag-majordate && return; name=$(basename $(dirname $(git rev-parse --show-toplevel))); major=$(basename $(git rev-parse --show-toplevel)); version=''${version:-$(TZ=UTC date +\"v$major.%Y%m%d\")} && set -x && git tag -s -m \"$name $version\" $version"'';
73 tag-cabal = ''"!set -x; for cabal in $(git ls-files | grep '.*\\.cabal$'); do name=$(sed -ne 's/^name: *\\(.*\\)/\\1/p' \"$cabal\"); version=$(sed -ne 's/^version: *\\(.*\\)/\\1/p' \"$cabal\"); git tag --merged | grep -Fqx \"$name-$version\" || git tag -f -s -m \"$name v$version\" $name-$version; done"'';
74 cl = "notes --ref=changelog append";
75 cl-bug = "notes --ref=changelogs/bugs append";
76 cl-feature = "notes --ref=changelogs/features append";
77 wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
78 };
79 extraConfig = {
80 browser.elinks.cmd = "elinks";
81 color.branch = "auto";
82 color.diff = "auto";
83 #color.diff.whitespace = "red reverse";
84 color.status = "auto";
85 core.commentChar = "auto";
86 core.quotepath = "false";
87 core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
88 diff.algorithm = "histogram";
89 diff.sqldiff.command = "sqldiff";
90 format.pretty = "oneline";
91 gui.fontdiff = ''-family "DejaVu Sans Mono" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
92 gui.fontui = ''-family "DejaVu Sans" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
93 gui.spellingdictionary = "en_US";
94 gui.tabsize = 4;
95 guitool."Rebase interactive" = {
96 cmd = "EDITOR=gvim git rebase -i $REVISION";
97 revprompt = true;
98 };
99 init.defaultBranch = "main";
100 merge.tool = "vimdiff";
101 merge.conflictStyle = "zdiff3";
102 protocol.version = 2;
103 pull.rebase = true;
104 push.default = "simple";
105 rebase.autosquash = "true";
106 sendemail.chainReplyTo = "false";
107 sendemail.composeencoding = "UTF-8";
108 sendemail.confirm = "always";
109 sendemail.envelopeSender = "auto";
110 sendemail.multiedit = "yes";
111 sendemail.suppressFrom = "false";
112 sendemail.suppresscc = "self";
113 sendemail.thread = "true";
114 sendemail.validate = "true";
115 web.browser = "elinks";
116 };
117 iniContent = {
118 /*
119 diff.external = lib.concatStringsSep " " [
120 "${pkgs.difftastic}/bin/difft"
121 "--color auto"
122 "--background dark"
123 "--display side-by-side"
124 ];
125 */
126 # difftastic
127 /*
128 diff.tool = "difftastic";
129 difftool.prompt = false;
130 difftool.difftastic.cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"'';
131 pager.difftool = true;
132 */
133
134 # delta
135 /*
136 core.pager = "delta";
137 interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only --features=interactive";
138 delta.features = "decorations";
139 delta.interactive = {
140 keep-plus-minus-markers = false;
141 };
142 delta.decorations = {
143 commit-decoration-style = "blue ol";
144 commit-style = "raw";
145 file-style = "omit";
146 hunk-header-decoration-style = "blue box";
147 hunk-header-file-style = "red";
148 hunk-header-line-number-style = "#067a00";
149 hunk-header-style = "file line-number syntax";
150 };
151 */
152 };
153 };
154 programs.bash = {
155 shellAliases = {
156 g = "git";
157 ge = "git-edit-commit";
158 gg = "git grep";
159 gge = "git-grep-edit";
160 gui = "gitui";
161 };
162 initExtra = ''
163 git-edit-commit () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); }
164 git-grep-edit () { $EDITOR $(git grep --name-only --recursive "$@"); }
165 '';
166 };
167 }