Universe/modules/git/default.nix

64 lines
2.0 KiB
Nix

# Universe - The big bang to my universe
#
# Copyright (c) 2023-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ user, email, signingKey ? null, extraConfig ? { } }:
{ pkgs, ... }: {
programs.git = {
enable = true;
package = pkgs.gitFull;
userName = user;
userEmail = email;
aliases = {
co = "checkout";
br = "branch";
ci = "commit";
st = "status";
unstage = "reset HEAD --";
last = "log -1 HEAD";
lg =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
brs =
"for-each-ref --sort='-authordate:iso8601' --count 20 --format=' %(color:green)%(authordate:relative)%09%(if)%(HEAD)%(then)%(color:brightwhite)*%(else)%(color:white) %(end)%(refname:short)%09%(color:yellow)%(authorname)%(authoremail)' refs/heads";
e = "emacsclient";
};
signing = if (signingKey != null) then {
key = signingKey;
signByDefault = true;
} else
null;
difftastic.enable = true;
# delta.enable = true;
extraConfig = {
core = {
abbrev = 12;
excludesFile = "${./gitignore}";
};
pretty = { fixes = ''Fixes: %h ("%s")''; };
# url."git@github.com:" = { insteadOf = "https://github.com/"; };
status.submoduleSummary = true;
pull.rebase = false;
http.sslVerify = true;
} // extraConfig;
};
}