git.nix 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. { pkgs, ... }:
  2. {
  3. home.packages = [
  4. pkgs.git
  5. pkgs.git-crypt
  6. ];
  7. programs.git = {
  8. enable = true;
  9. userName = "Thomas Stachl";
  10. userEmail = "[email protected]";
  11. signing = {
  12. key = "ED5EAAA8E895B23A";
  13. signByDefault = true;
  14. signer = "${pkgs.gnupg}/bin/gpg";
  15. };
  16. aliases = {
  17. b = "branch";
  18. bc = "checkout -b";
  19. bl = "branch -v";
  20. bL = "branch -av";
  21. bx = "branch -d";
  22. bX = "branch -D";
  23. bm = "branch -m";
  24. bM = "branch -M";
  25. bs = "show-branch";
  26. bS = "show-branch -a";
  27. co = "checkout";
  28. co0 = "checkout HEAD --";
  29. f = "fetch";
  30. fm = "pull";
  31. fo = "fetch origin";
  32. m = "merge";
  33. mom = "merge origin/master";
  34. p = "push";
  35. pa = "push --all";
  36. pt = "push --tags";
  37. r = "rebase";
  38. ra = "rebase --abort";
  39. rc = "rebase --continue";
  40. ri = "rebase --interactive";
  41. rs = "rebase --skip";
  42. rom = "rebase origin/master";
  43. c = "commit -v";
  44. ca = "commit --all -v";
  45. cm = "commit --message";
  46. cam = "commit --all --message";
  47. camend = "commit --amend --reuse-message HEAD";
  48. cundo = "reset --soft 'HEAD^'";
  49. cp = "cherry-pick";
  50. d = "diff # Diff working dir to index";
  51. ds = "diff --staged # Diff index to HEAD";
  52. dc = "diff --staged # Diff index to HEAD";
  53. dh = "diff HEAD # Diff working dir and index to HEAD";
  54. hub = "browse";
  55. hubd = "compare";
  56. s = "status";
  57. a = "add";
  58. ia = "add";
  59. ir = "reset";
  60. l = "log --topo-order --pretty=format:'%C(yellow)%h %C(cyan)%cn %C(blue)%cr%C(reset) %s'";
  61. ls = "log --topo-order --stat --pretty=format:'%C(bold)%C(yellow)Commit:%C(reset) %C(yellow)%H%C(red)%d%n%C(bold)%C(yellow)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)%C(yellow)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'";
  62. ld = "log --topo-order --stat --patch --full-diff --pretty=format:'%C(bold)%C(yellow)Commit:%C(reset) %C(yellow)%H%C(red)%d%n%C(bold)%C(yellow)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)%C(yellow)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'";
  63. lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
  64. lga = "log --topo-order --all --graph --pretty=format:'%C(yellow)%h %C(cyan)%cn%C(reset) %s %C(red)%d%C(reset)%n'";
  65. lm = "log --topo-order --pretty=format:'%s'";
  66. lh = "shortlog --summary --numbered";
  67. llf = "fsck --lost-found";
  68. lg1 = "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all";
  69. lg2 = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
  70. re = "remote";
  71. rel = "remote --verbose";
  72. rea = "remote add";
  73. rex = "remote rm";
  74. rem = "remote rename";
  75. };
  76. extraConfig = {
  77. core = {
  78. editor = "vim";
  79. pager = "less -FRSX";
  80. whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
  81. };
  82. color = {
  83. grep = "always";
  84. pager = "true";
  85. showbranch = "auto";
  86. ui = "always";
  87. interactive = {
  88. error = "red bold";
  89. };
  90. branch = {
  91. current = "yellow reverse";
  92. local = "yellow";
  93. remote = "green";
  94. };
  95. diff = {
  96. meta = "yellow";
  97. frag = "magenta";
  98. old = "red";
  99. new = "green";
  100. whitespace = "white reverse";
  101. };
  102. status = {
  103. added = "yellow";
  104. changed = "green";
  105. untracked = "cyan";
  106. branch = "magenta";
  107. };
  108. };
  109. diff.tool = "vimdiff";
  110. difftool.prompt = "false";
  111. merge.tool = "vimdiff";
  112. push.default = "matching";
  113. pull.rebase = "false";
  114. init.defaultBranch = "master";
  115. url = {
  116. "[email protected]:" = {
  117. insteadOf = "github:";
  118. };
  119. };
  120. branch = {
  121. master = {
  122. remote = "origin";
  123. merge = "refs/head/master";
  124. };
  125. };
  126. };
  127. };
  128. }
  129. # [filter "lfs"]
  130. # clean = git-lfs clean -- %f
  131. # smudge = git-lfs smudge -- %f
  132. # process = git-lfs filter-process
  133. # required = true
  134. # TODO: Proton Drive
  135. # ln -s ~/Library/CloudStorage/[email protected]/Photos ~/Photos