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