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