feat(agents): add gitIdentity module
- Renamed shared-options.nix to shared/shared-options.nix - Created shared/default.nix importing git-identity.nix and shared-options.nix - Created shared/git-identity.nix with gitIdentity option set: - enable: Toggle for agent git identity - name: Git author name (default: m3ta-chiron) - email: Git author email (default: m3ta-chiron@agentmail.to) - signingKey: Optional GPG signing key path - sshKey: SSH private key path for git push auth - Updated opencode.nix, pi.nix, claude-code.nix to import shared/default.nix - Restructured modules to follow proper Nix module syntax with imports at top level
This commit is contained in:
64
modules/home-manager/coding/agents/shared/git-identity.nix
Normal file
64
modules/home-manager/coding/agents/shared/git-identity.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
# Git identity module for agent commits.
|
||||
# Sets GIT_AUTHOR_*, GIT_COMMITTER_*, and GIT_SSH_COMMAND environment variables.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.coding.agents.gitIdentity;
|
||||
in {
|
||||
options.coding.agents.gitIdentity = {
|
||||
enable = lib.mkEnableOption ''
|
||||
Agent Git identity for commits. When enabled, sets GIT_AUTHOR_* and
|
||||
GIT_COMMITTER_* environment variables for consistent bot identity.
|
||||
'';
|
||||
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "m3ta-chiron";
|
||||
description = "Git user name for agent commits.";
|
||||
example = "m3ta-chiron";
|
||||
};
|
||||
|
||||
email = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "m3ta-chiron@agentmail.to";
|
||||
description = "Git email for agent commits.";
|
||||
example = "m3ta-chiron@agentmail.to";
|
||||
};
|
||||
|
||||
signingKey = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Optional GPG signing key for verified commits.
|
||||
Set to null to disable signing.
|
||||
'';
|
||||
example = "/home/user/.gnupg/sign_key.gpg";
|
||||
};
|
||||
|
||||
sshKey = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
Path to SSH private key for git push authentication.
|
||||
Use agenix-managed paths like /run/agenix/m3ta-chiron-ssh-key
|
||||
for secure secret management.
|
||||
'';
|
||||
example = "/run/agenix/m3ta-chiron-ssh-key";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.sessionVariables = {
|
||||
# Git author/committer identity
|
||||
GIT_AUTHOR_NAME = cfg.name;
|
||||
GIT_AUTHOR_EMAIL = cfg.email;
|
||||
GIT_COMMITTER_NAME = cfg.name;
|
||||
GIT_COMMITTER_EMAIL = cfg.email;
|
||||
|
||||
# SSH command for git push
|
||||
GIT_SSH_COMMAND = "ssh -i ${cfg.sshKey} -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user