1
1
Fork 0

git: refactor config

This commit is contained in:
Myned 2025-03-31 19:07:46 -05:00
parent 441078e4dd
commit 8e16e85401
Signed by: Myned
GPG key ID: C7224454F7881A34

View file

@ -6,34 +6,89 @@
with lib; let
cfg = config.custom.programs.git;
in {
options.custom.programs.git.enable = mkOption {default = false;};
options.custom.programs.git = {
enable = mkOption {default = false;};
};
config.home-manager.users.${config.custom.username} = mkIf cfg.enable {
# https://wiki.archlinux.org/title/Git
# https://git-scm.com
programs.git = {
enable = true;
userName = "Myned";
userEmail = "dev@${config.custom.domain}";
config = mkIf cfg.enable {
home-manager.sharedModules = [
{
# https://git-scm.com
# https://wiki.nixos.org/wiki/Git
# https://wiki.archlinux.org/title/Git
programs.git = {
enable = true;
userName = "Myned";
userEmail = "dev@${config.custom.domain}";
# BUG: GitHub Desktop tries to enable if this is not in gitconfig
lfs.enable = true; # Enable Large File Storage
# BUG: GitHub Desktop tries to enable if this is not in gitconfig
lfs.enable = true; # Large File Storage
signing = {
signByDefault = true;
key = "C7224454F7881A34";
};
signing = {
# TODO: Use ssh signing
format = "openpgp";
signByDefault = true;
key = "C7224454F7881A34";
};
extraConfig = {
fetch.prune = true;
init.defaultBranch = "master";
push.autoSetupRemote = true;
pull.ff = "only";
url."git@github.com:".insteadOf = [
"gh:"
"github:"
];
};
};
# https://git-scm.com/docs/git-config
# https://git-scm.com/book/en/v2/
# https://jvns.ca/blog/2024/02/16/popular-git-config-options/
extraConfig = {
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-alias
#?? git ALIAS
alias = {
# https://wiki.archlinux.org/title/Git#Visual_representation
graph = "log --graph --oneline --decorate";
};
diff = {
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-codediffalgorithmcode
algorithm = "histogram";
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-codediffcolorMovedcode
colorMoved = true;
};
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-fetchprune
fetch.prune = true;
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-formatsignOff
#?? Signed-off-by: USERNAME <EMAIL>
format.signOff = true;
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-helpautoCorrect
help.autoCorrect = "prompt";
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-codeinitdefaultBranchcode
init.defaultBranch = "master"; # owo
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-mergeconflictStyle
merge.conflictStyle = "zdiff3";
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushautoSetupRemote
push.autoSetupRemote = true;
# https://git-scm.com/docs/git-rebase
rebase = {
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-rebaseautoSquash
autoSquash = true;
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-rebaseautoStash
autoStash = true;
};
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-rerereenabled
rerere.enabled = true; # reuse recovered resolution
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-submodulerecurse
submodule.recurse = true;
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-transferfsckObjects
transfer.fsckObjects = true;
};
};
}
];
};
}