nixos/modules/common/git.nix
2025-05-22 21:19:25 -04:00

37 lines
862 B
Nix

{
pkgs,
lib,
...
}: {
programs.git = {
enable = true;
config = {
user = {
name = "Henry-Hiles";
email = "henry@henryhiles.com";
signingKey = builtins.elemAt (import ../../secrets/keys.nix) 0;
};
url = {
"git@github.com:".insteadOf = ["https://github.com/"];
"git@git.henryhiles.com:".insteadOf = ["https://git.henryhiles.com"];
};
init.defaultBranch = "main";
commit.gpgsign = true;
pull.rebase = true;
gpg.format = "ssh";
};
};
environment = {
systemPackages = [pkgs.gh];
shellAliases = let
gitExe = lib.meta.getExe pkgs.git;
ghExe = lib.meta.getExe pkgs.gh;
in {
clone = "${ghExe} repo clone";
create = "${ghExe} repo create";
push = "${gitExe} push";
commit = "${gitExe} commit -am";
};
};
}