dotnix/apps/nogui/git.nix

72 lines
1.8 KiB
Nix

{config, ...}: let
key = "0xB853ADA5DA7BBF7A";
insteadOf = prefix: domain: {
"https://${domain}/".insteadOf = "${prefix}:";
"git@${domain}:".insteadOf = "ssh:${prefix}:";
};
in {
programs.git = {
enable = true;
userName = "jolheiser";
userEmail = "john.olheiser@gmail.com";
signing = {
signByDefault = true;
key = key;
};
aliases = {
wt = "worktree";
ci = "commit -s -S -m";
br = "branch";
aa = "add .";
adog = "log --all --decorate --oneline --graph";
poh = "push origin HEAD";
cb = "checkout -b";
fu = "fetch upstream";
fo = "fetch origin";
dh = "diff HEAD";
unstage = "restore --staged";
last = "log --show-signature --format=fuller --max-count=1 HEAD";
tui = "!lazygit";
};
lfs.enable = true;
ignores = [".idea/" "result" "node_modules" "ve"];
extraConfig = {
init.defaultBranch = "main";
merge.conflictstyle = "zdiff3";
diff.colorMoved = "default";
core.editor = "hx";
push = {
sutoSetupRemote = true;
default = "current";
gpgSign = "if-asked";
};
rerere.enabled = true;
pull.rebase = true;
diff.algorithm = "histogram";
merge.tool = "hx";
url =
insteadOf "jo" "git.jolheiser.com"
// insteadOf "gh" "github.com"
// insteadOf "jj" "git.jojodev.com"
// insteadOf "gt" "gitea.com"
// insteadOf "gl" "gitlab.com"
// insteadOf "cb" "codeberg.org";
};
delta = {
enable = true;
options = {
features = "ctp-mocha";
navigate = true;
light = false;
line-numbers = true;
side-by-side = true;
};
};
includes = [
{
path = config.age.secrets.git-send-email.path;
}
];
};
}