refactor(home): extract git config to its own file

This commit is contained in:
Pierre Martin
2022-09-03 07:34:57 +02:00
parent 6c5794f79b
commit 12fb4f08c2
2 changed files with 48 additions and 44 deletions

View File

@@ -9,6 +9,7 @@
[ [
./packages.nix ./packages.nix
./programs/git.nix
./programs/i3.nix ./programs/i3.nix
./programs/zsh.nix ./programs/zsh.nix
]; ];
@@ -28,50 +29,6 @@
terminal = "sakura"; terminal = "sakura";
}; };
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userEmail = "pierre@front-commerce.com";
userName = "Pierre Martin";
aliases = {
co = "checkout";
mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
};
ignores = [
".DS_Store"
".svn"
"*~"
"*.swp"
"*.rbc"
".watsonrc"
".idea"
".vscode"
];
extraConfig = {
# see https://github.com/dandavison/delta#get-started
core.pager = "delta";
interactive.diffFilter = "delta --color-only";
delta.navigate = true;
merge.conflictstyle = "diff3";
diff.colorMoved = "default";
merge.tool = "meld";
diff.algorithm = "patience";
pull.ff = "only";
credential.helper = "store";
init.defaultBranch = "main";
# see https://betterprogramming.pub/8-advanced-git-commands-university-wont-teach-you-fe63b483d34b
help.autocorrect = 1;
fetch.prune = true;
push.autoSetupRemote = true;
};
};
programs.htop = { programs.htop = {
enable = true; enable = true;
}; };

47
programs/git.nix Normal file
View File

@@ -0,0 +1,47 @@
{ pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userEmail = "pierre@front-commerce.com";
userName = "Pierre Martin";
aliases = {
co = "checkout";
mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
};
ignores = [
".DS_Store"
".svn"
"*~"
"*.swp"
"*.rbc"
".watsonrc"
".idea"
".vscode"
];
extraConfig = {
# see https://github.com/dandavison/delta#get-started
core.pager = "delta";
interactive.diffFilter = "delta --color-only";
delta.navigate = true;
merge.conflictstyle = "diff3";
diff.colorMoved = "default";
merge.tool = "meld";
diff.algorithm = "patience";
pull.ff = "only";
credential.helper = "store";
init.defaultBranch = "main";
# see https://betterprogramming.pub/8-advanced-git-commands-university-wont-teach-you-fe63b483d34b
help.autocorrect = 1;
fetch.prune = true;
push.autoSetupRemote = true;
};
};
}