50 lines
1.1 KiB
Nix
50 lines
1.1 KiB
Nix
{
|
|
options,
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
with lib.wyrdgard;
|
|
let
|
|
cfg = config.wyrdgard.tools.git;
|
|
user = config.wyrdgard.user;
|
|
in
|
|
{
|
|
options.wyrdgard.tools.git = {
|
|
enable = mkBoolOpt true "Enable Git (Default true)";
|
|
userName = mkOpt types.str user.fullName "The name to configure git with.";
|
|
userEmail = mkOpt types.str user.email "The email to configure git with.";
|
|
signingKey =
|
|
mkOpt types.str "6995A5FF33791B7B" "The pub key to sign commits with.";
|
|
signByDefault = mkOpt types.bool true "Whether to sign commits by default.";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
programs.git = {
|
|
enable = true;
|
|
inherit (cfg) userName userEmail;
|
|
lfs = enabled;
|
|
signing = {
|
|
key = cfg.signingKey;
|
|
inherit (cfg) signByDefault;
|
|
};
|
|
extraConfig = {
|
|
init = {
|
|
defaultBranch = "main";
|
|
};
|
|
pull = {
|
|
rebase = false;
|
|
};
|
|
push = {
|
|
autoSetupRemote = true;
|
|
};
|
|
safe = {
|
|
directory = "${user.home}/projects/config";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|