2024-11-19 10:31:29 +01:00
|
|
|
{
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-03-21 15:00:36 +01:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
with lib.metacfg;
|
|
|
|
let
|
|
|
|
cfg = config.metacfg.tools.git;
|
|
|
|
gpg = config.metacfg.security.gpg;
|
|
|
|
user = config.metacfg.user;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.metacfg.tools.git = with types; {
|
|
|
|
enable = mkBoolOpt false "Whether or not to install and configure git.";
|
|
|
|
userName = mkOpt types.str user.fullName "The name to configure git with.";
|
|
|
|
userEmail = mkOpt types.str user.email "The email to configure git with.";
|
2024-11-19 10:31:29 +01:00
|
|
|
signingKey = mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with.";
|
2024-03-21 15:00:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [ git ];
|
|
|
|
|
|
|
|
metacfg.home.extraOptions = {
|
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
inherit (cfg) userName userEmail;
|
|
|
|
lfs = enabled;
|
|
|
|
signing = {
|
|
|
|
key = cfg.signingKey;
|
|
|
|
signByDefault = mkIf gpg.enable true;
|
|
|
|
};
|
|
|
|
extraConfig = {
|
2024-11-19 10:31:29 +01:00
|
|
|
init = {
|
|
|
|
defaultBranch = "main";
|
|
|
|
};
|
|
|
|
pull = {
|
|
|
|
rebase = true;
|
|
|
|
};
|
|
|
|
push = {
|
|
|
|
autoSetupRemote = true;
|
|
|
|
};
|
|
|
|
core = {
|
|
|
|
whitespace = "trailing-space,space-before-tab";
|
|
|
|
};
|
2024-03-21 15:00:36 +01:00
|
|
|
safe = {
|
|
|
|
directory = "${user.home}/git";
|
|
|
|
};
|
|
|
|
"credential \"https://github.com\"" = {
|
|
|
|
helper = "!gh auth git-credential";
|
|
|
|
};
|
|
|
|
alias = {
|
|
|
|
co = "checkout";
|
|
|
|
ci = "commit --signoff";
|
|
|
|
};
|
|
|
|
pull.ff = "only";
|
|
|
|
core.pager = "${pkgs.delta}/bin/delta";
|
|
|
|
delta = {
|
|
|
|
features = "decorations";
|
|
|
|
syntax-theme = "DarkNeon";
|
|
|
|
light = "false";
|
|
|
|
navigate = "true";
|
|
|
|
};
|
|
|
|
interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
|
|
|
|
merge.conflictStyle = "diff3";
|
|
|
|
diff.colorMoved = "default";
|
2024-09-04 13:23:08 +02:00
|
|
|
http.sslCAinfo = "/etc/ssl/certs/ca-certificates.crt";
|
2024-10-16 14:57:30 +02:00
|
|
|
submodule.recurse = true;
|
2024-03-21 15:00:36 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|