nix all the things
1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7{
8 config = lib.mkIf config.dev.vcs.enable {
9 home.packages = [ pkgs.gh ];
10 programs.git = {
11 enable = true;
12 ignores = [
13 "/notes"
14 "/tmp"
15 ".direnv"
16 ".envrc"
17 ];
18
19 signing = {
20 key = "~/.ssh/id_ed25519.pub";
21 signByDefault = true;
22 };
23
24 settings = {
25 user = {
26 name = "karitham";
27 email = "kar@karitham.dev";
28 };
29
30 alias = {
31 co = "checkout";
32 ci = "commit";
33 st = "status";
34 br = "branch";
35 hist = "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short";
36 type = "cat-file -t";
37 dump = "cat-file -p";
38 dft = "difftool";
39 };
40
41 init.defaultBranch = "main";
42 merge.stat = true;
43 pull.rebase = true;
44
45 push = {
46 autoSetupRemote = true;
47 default = "current";
48 };
49
50 url."ssh://git@github.com/".insteadOf = "https://github.com/";
51
52 gpg = {
53 format = "ssh";
54 ssh.defaultKeyCommand = "ssh-add -L";
55 };
56
57 core = {
58 editor = config.home.sessionVariables.EDITOR;
59 whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
60 };
61
62 pager.difftool = true;
63 diff.tool = "difftastic";
64 difftool = {
65 prompt = false;
66 difftastic.cmd = "${pkgs.difftastic}/bin/difft --color auto --background light --display side-by-side \"$LOCAL\" \"$REMOTE\"";
67 };
68
69 rebase = {
70 autoSquash = true;
71 autoStash = true;
72 updateRefs = true;
73 };
74
75 rerere = {
76 enabled = true;
77 autoUpdate = true;
78 };
79 };
80 };
81 };
82}