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