]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/git.nix
courge: sanoid: setup
[julm/julm-nix.git] / home-manager / profiles / git.nix
1 { pkgs, lib, ... }:
2 {
3 home.packages = [
4 pkgs.b4
5 pkgs.git-chglog
6 pkgs.git-cliff
7 pkgs.git-crypt
8 pkgs.git-filter-repo
9 #pkgs.git-publish
10 pkgs.git-quick-stats
11 pkgs.tig
12 ];
13 programs.git = {
14 enable = true;
15 ignores = [ "*~" "*.swp" ];
16 package = lib.mkDefault pkgs.gitMinimal;
17 aliases = {
18 a = "add";
19 ap = "add -p";
20 authors = "shortlog -s -n";
21 bl = "git log -p -M --follow --stat --";
22 b = "branch";
23 c = "commit";
24 ca = "commit --amend";
25 caa = "commit --amend -C@";
26 caaa = "commit --amend -C@ -a";
27 cf = "commit --fixup";
28 co = "checkout";
29 d = "diff";
30 dc = "diff --cached";
31 dh = "diff --histogram";
32 dp = "diff --patience";
33 g = "grep";
34 ign = "ls-files -o -i --exclude-standard";
35 l = "log";
36 ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
37 lp = "log -p --pretty=fuller";
38 lpg = "log -p --pretty=fuller -g";
39 p = "push -v";
40 pf = "push -vf";
41 pu = "pull";
42 r = "reset";
43 rh = "reset --hard";
44 ri = "rebase -i";
45 rp = "reset -p";
46 s = "status";
47 spull = "!git-svn fetch && git-svn rebase";
48 spush = "!git-svn dcommit";
49 ss = "status -s";
50 st = "status -uno";
51 sw = "switch";
52 fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
53 pull-local = "!git fetch-local && git checkout -B master local/master";
54 pull-local-old = "!git fetch-local && git checkout HEAD'^' && git branch -f master local/master && git checkout master";
55 root = ''!git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"'';
56 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]\\(\\^{}\\)\\?\"'';
57 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"'';
58 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]\\(\\^{}\\)\\?\"'';
59 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"'';
60 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"'';
61 cl = "notes --ref=changelog append";
62 cl-bug = "notes --ref=changelogs/bugs append";
63 cl-feature = "notes --ref=changelogs/features append";
64 wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
65 };
66 extraConfig = {
67 browser.elinks.cmd = "elinks";
68 color.branch = "auto";
69 color.diff = "auto";
70 #color.diff.whitespace = "red reverse";
71 color.status = "auto";
72 core.commentChar = "auto";
73 core.quotepath = "false";
74 core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
75 diff.algorithm = "histogram";
76 diff.sqldiff.command = "sqldiff";
77 format.pretty = "oneline";
78 gui.fontdiff = ''-family "DejaVu Sans Mono" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
79 gui.fontui = ''-family "DejaVu Sans" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
80 gui.spellingdictionary = "en_US";
81 gui.tabsize = 4;
82 guitool."Rebase interactive" = {
83 cmd = "EDITOR=gvim git rebase -i $REVISION";
84 revprompt = true;
85 };
86 init.defaultBranch = "main";
87 merge.tool = "vimdiff";
88 protocol.version = 2;
89 pull.rebase = true;
90 push.default = "simple";
91 rebase.autosquash = "true";
92 sendemail.chainReplyTo = "false";
93 sendemail.composeencoding = "UTF-8";
94 sendemail.confirm = "always";
95 sendemail.envelopeSender = "auto";
96 sendemail.multiedit = "yes";
97 sendemail.suppressFrom = "false";
98 sendemail.suppresscc = "self";
99 sendemail.thread = "true";
100 sendemail.validate = "true";
101 web.browser = "elinks";
102 };
103 };
104 }