nix/modules/home-manager/git.nix

110 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2023-10-05 13:43:28 -05:00
{lib, ...}: let
email = lib.mkDefault "daniel@lyte.dev";
in {
programs.git = {
enable = true;
userName = lib.mkDefault "Daniel Flanagan";
userEmail = email;
2023-10-05 13:43:28 -05:00
delta = {
enable = true;
options = {};
};
lfs = {
enable = true;
};
# signing = {
# signByDefault = false;
# key = ~/.ssh/personal-ed25519;
# };
2023-10-05 13:43:28 -05:00
aliases = {
a = "add -A";
ac = "commit -a";
acm = "commit -a -m";
2023-10-05 13:43:28 -05:00
c = "commit";
cm = "commit -m";
co = "checkout";
b = "rev-parse --symbolic-full-name HEAD";
cnv = "commit --no-verify";
cns = "commit --no-gpg-sign";
cnvs = "commit --no-verify --no-gpg-sign";
cnsv = "commit --no-verify --no-gpg-sign";
2023-10-05 13:43:28 -05:00
d = "diff";
ds = "diff --staged";
dt = "difftool";
2023-10-05 13:43:28 -05:00
f = "fetch";
fa = "fetch --all";
2023-10-05 13:43:28 -05:00
l = "log --graph --abbrev-commit --decorate --oneline --all";
plainlog = " log --pretty=format:'%h %ad%x09%an%x09%s' --date=short --decorate";
ls = "ls-files";
mm = "merge master";
p = "push";
pf = "push --force-with-lease";
pl = "pull";
rim = "rebase -i master";
s = "status";
};
2024-01-13 14:38:31 -06:00
# TODO: https://blog.scottlowe.org/2023/12/15/conditional-git-configuration/
2023-10-05 13:43:28 -05:00
extraConfig = {
commit = {
verbose = true;
# gpgSign = true;
};
tag = {
# gpgSign = true;
sort = "version:refname";
};
# include.path = local.gitconfig
gpg.format = "ssh";
log.date = "local";
init.defaultBranch = "main";
merge.conflictstyle = "zdiff3";
push.autoSetupRemote = true;
2023-10-05 13:43:28 -05:00
branch.autoSetupMerge = true;
2023-10-05 13:43:28 -05:00
sendemail = {
smtpserver = "smtp.mailgun.org";
smtpuser = email;
smtrpencryption = "tls";
smtpserverport = 587;
};
url = {
# TODO: how to have per-machine not-in-git configuration?
"git@git.hq.bill.com:" = {
insteadOf = "https://git.hq.bill.com";
};
};
};
};
programs.fish.functions = {
g = {
wraps = "git";
body = ''
if test (count $argv) -gt 0
git $argv
else
git status
end
'';
};
2023-10-05 13:43:28 -05:00
};
}