nix-config/modules/home-manager/terminal/git.nix

80 lines
2 KiB
Nix
Raw Normal View History

2024-03-24 17:39:49 -05:00
{
config,
pgks,
2024-03-24 22:56:01 -05:00
lib,
2024-03-24 17:39:49 -05:00
...
}: {
2024-03-24 22:56:01 -05:00
options = {
host.git.workProfile = {
enable = lib.mkEnableOption "git work profile";
email = lib.mkOption {
type = lib.types.str;
description = "email for work profile.";
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
};
host.git.profile = {
email = lib.mkOption {
type = lib.types.str;
description = "email for main profile";
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
name = lib.mkOption {
type = lib.types.str;
description = "name for main profile";
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
};
};
config = {
programs.git = {
enable = true;
aliases = {
hist = "log --graph --date-order --date=short --pretty=format:'%C(auto)%h%d %C(reset)%s %C(bold blue)%ce %C(reset)%C(green)%cr (%cd)'";
graph = "log --graph --topo-order --all --pretty=format:'%C(auto)%h %C(cyan)%an %C(blue)%ar %C(auto)%d %s'";
recent = "branch --sort=-committerdate --format='%(committerdate:relative)%09%(refname:short)'";
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
delta.enable = true;
# difftastic.enable=true;
# difftastic.background="dark";
userEmail = config.host.git.profile.email;
userName = config.host.git.profile.name;
extraConfig = {
init = {
defaultBranch = "main";
};
push = {
autoSetupRemote = true;
default = "current";
};
pull = {
ff = true;
};
merge = {
conflictstyle = "zdiff3";
};
rebase = {
autosquash = true;
};
help = {
autocorrect = "prompt";
};
branch = {
sort = "-committerdate";
};
status = {
submodulesummary = true;
};
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
includes =
if config.host.git.workProfile.enable
then [
{
2024-03-28 12:19:32 -05:00
condition = "gitdir:~/work/**";
2024-03-24 22:56:01 -05:00
contents.user.email = config.host.git.workProfile.email;
}
]
else [];
2024-03-24 17:39:49 -05:00
};
2024-03-24 22:56:01 -05:00
programs.lazygit.enable = true;
2024-03-24 17:39:49 -05:00
};
}