nix-config/modules/home/git.nix

53 lines
2 KiB
Nix

{ pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitFull;
lfs.enable = true;
signing = {
signByDefault = true;
format = "ssh";
key = "~/.ssh/id_ed25519";
};
settings = {
init.defaultBranch = "master";
user.name = "Moritz Huber";
user.email = "2nd@moritzhuber.de";
push.autoSetupRemote = true;
alias = {
lg = "lg1";
lg1 = "lg1-specific --all";
lg2 = "lg2-specific --all";
lg3 = "lg3-specific --all";
lg1-specific = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'";
lg2-specific = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'";
lg3-specific = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'";
};
url."ssh://git@gitlab.lrz.de/" = {
insteadOf = "https://gitlab.lrz.de/";
};
url."ssh://git@git.fs.cs.hm.edu/" = {
insteadOf = "https://git.fs.cs.hm.edu/";
};
};
includes = [
{
condition = "hasconfig:remote.*.url:git@gitlab.lrz.de:*/**";
contents = {
user.email = "moritz.huber@hm.edu";
commit.gpgsign = false;
};
}
{
condition = "hasconfig:remote.*.url:git@git.fs.cs.hm.edu:*/**";
contents = {
user.email = "mhuber@fs.cs.hm.edu";
user.signingKey = "~/.ssh/fs/hmKey";
commit.gpgSign = true;
gpg.format = "ssh";
};
}
];
};
}