From e52d474d85a0073006bb972e8c352de05f1f8d59 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 29 Jul 2021 11:07:14 +0200 Subject: [PATCH] home: git: setup git config --- home/default.nix | 1 + home/git.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 home/git.nix diff --git a/home/default.nix b/home/default.nix index 7850575..0ddda5f 100644 --- a/home/default.nix +++ b/home/default.nix @@ -7,6 +7,7 @@ ./env.nix ./fish ./flameshot.nix + ./git.nix ./laptop.nix ./secrets ./starship.nix diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..d8428b6 --- /dev/null +++ b/home/git.nix @@ -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"; }; }; + } + ]; + }; + }; +}