home: git: setup git config

This commit is contained in:
Antoine Martin 2021-07-29 11:07:14 +02:00
parent 9b4d3852c3
commit e52d474d85
2 changed files with 48 additions and 0 deletions

View file

@ -7,6 +7,7 @@
./env.nix ./env.nix
./fish ./fish
./flameshot.nix ./flameshot.nix
./git.nix
./laptop.nix ./laptop.nix
./secrets ./secrets
./starship.nix ./starship.nix

47
home/git.nix Normal file
View file

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.home.git;
in
{
options.my.home.git.enable = (lib.mkEnableOption "Git configuration") // { default = true; };
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
lfs.enable = true;
userEmail = "antoine@alarsyo.net";
userName = "Antoine Martin";
extraConfig = {
commit = { verbose = true; };
core = { editor = "vim"; };
init = { defaultBranch = "main"; };
pull = { rebase = true; };
rerere = { enabled = true; };
};
aliases = {
push-wip = "push -o ci.skip";
push-merge = "push -o merge_request.create -o merge_request.merge_when_pipeline_succeeds -o merge_request.remove_source_branch";
push-mr = "push -o merge_request.create -o merge_request.remove_source_branch";
};
includes = [
{
condition = "gitdir:~/work/lrde";
contents = { user = { email = "amartin@lrde.epita.fr"; }; };
}
{
condition = "gitdir:~/work/prologin";
contents = { user = { email = "antoine.martin@prologin.org"; }; };
}
{
condition = "gitdir:~/work/epita";
contents = { user = { email = "antoine4.martin@epita.fr"; }; };
}
];
};
};
}