This commit is contained in:
2026-06-22 18:27:20 +09:00
parent b50586b936
commit 9166528301
3 changed files with 37 additions and 17 deletions
+24 -16
View File
@@ -10,13 +10,28 @@ in
{
options.my.applications.git.homeManager = {
enable = lib.mkEnableOption "git home-manager configuration";
signingKey = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = "~/.ssh/id_ed25519_sk_rk.pub";
example = "~/.ssh/id_ed25519.pub";
description = "SSH public key path used for Git commit and tag signing.";
};
};
config.home-manager.sharedModules = [
{
config = lib.mkIf hmCfg.enable {
config = lib.mkIf hmCfg.enable {
assertions = [
{
assertion = hmCfg.signingKey != null;
message = "my.applications.git.homeManager.signingKey must be set per host.";
}
];
home-manager.sharedModules = [
{
programs.git = {
enable = true;
ignores = [
".direnv/"
".envrc"
@@ -24,12 +39,15 @@ in
];
signing = {
key = hmCfg.signingKey;
format = "ssh";
signByDefault = true;
};
settings = {
user.name = cfg.userName;
user.email = cfg.userEmail;
push.default = "simple";
credential.helper = "cache --timeout=7200";
init.defaultBranch = "main";
@@ -37,16 +55,6 @@ in
log.date = "iso";
merge.conflictStyle = "diff3";
tag.gpgSign = true;
gpg = {
format = "ssh";
ssh = {
defaultKeyCommand = "ssh-add -L";
};
};
alias = {
br = "branch --sort=-committerdate";
co = "checkout";
@@ -59,7 +67,7 @@ in
};
};
};
};
}
];
}
];
};
}