mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-12 05:22:00 +01:00
61 lines
1.2 KiB
Nix
61 lines
1.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
# `programs.git` will generate the config file: ~/.config/git/config
|
|
# to make git use this config file, `~/.gitconfig` should not exist!
|
|
#
|
|
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
|
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
|
rm -f ~/.gitconfig
|
|
'';
|
|
|
|
programs.git = {
|
|
enable = true;
|
|
lfs.enable = true;
|
|
|
|
userName = "Ryan Yin";
|
|
userEmail = "xiaoyin_c@qq.com";
|
|
|
|
includes = [
|
|
{
|
|
# use diffrent email & name for work
|
|
path = "~/work/.gitconfig";
|
|
condition = "gitdir:~/work/";
|
|
}
|
|
];
|
|
|
|
extraConfig = {
|
|
pull = {
|
|
rebase = true;
|
|
};
|
|
|
|
# replace https with ssh
|
|
url = {
|
|
"ssh://git@github.com/" = {
|
|
insteadOf = "https://github.com/";
|
|
};
|
|
"ssh://git@gitlab.com/" = {
|
|
insteadOf = "https://gitlab.com/";
|
|
};
|
|
"ssh://git@bitbucket.com/" = {
|
|
insteadOf = "https://bitbucket.com/";
|
|
};
|
|
};
|
|
};
|
|
|
|
# signing = {
|
|
# key = "xxx";
|
|
# signByDefault = true;
|
|
# };
|
|
|
|
delta = {
|
|
enable = true;
|
|
options = {
|
|
features = "side-by-side";
|
|
};
|
|
};
|
|
};
|
|
} |