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:
@@ -3,11 +3,15 @@
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
shared = import ./shared-options.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
options.coding.agents.opencode = {
|
||||
}: {
|
||||
imports = [
|
||||
../shared/default.nix
|
||||
];
|
||||
|
||||
options.coding.agents.opencode = let
|
||||
shared = import ../shared/shared-options.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
enable = mkEnableOption "OpenCode agent management via canonical agent.toml definitions";
|
||||
|
||||
agentsInput = shared.mkAgentsInputOption ''
|
||||
@@ -19,13 +23,17 @@ in
|
||||
modelOverrides = shared.mkModelOverridesOption;
|
||||
};
|
||||
|
||||
config = mkIf config.coding.agents.opencode.enable {
|
||||
config = with lib; let
|
||||
shared = import ../shared/shared-options.nix {inherit lib;};
|
||||
cfg = config.coding.agents.opencode;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
# Rendered agent files symlinked to ~/.config/opencode/agents/
|
||||
xdg.configFile."opencode/agents" = let
|
||||
cfg = config.coding.agents.opencode;
|
||||
agentsLib = (import ../../../../lib {inherit lib;}).agents;
|
||||
in
|
||||
mkIf (cfg.agentsInput != null) {
|
||||
source = (import ../../../../lib {inherit lib;}).agents.renderForOpencode {
|
||||
source = agentsLib.renderForOpencode {
|
||||
inherit pkgs;
|
||||
canonical = cfg.agentsInput.lib.loadAgents;
|
||||
modelOverrides = cfg.modelOverrides;
|
||||
@@ -33,23 +41,14 @@ in
|
||||
};
|
||||
|
||||
# Static config dirs from AGENTS repo
|
||||
xdg.configFile."opencode/context" = let
|
||||
cfg = config.coding.agents.opencode;
|
||||
in
|
||||
mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/context";
|
||||
};
|
||||
xdg.configFile."opencode/commands" = let
|
||||
cfg = config.coding.agents.opencode;
|
||||
in
|
||||
mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/commands";
|
||||
};
|
||||
xdg.configFile."opencode/prompts" = let
|
||||
cfg = config.coding.agents.opencode;
|
||||
in
|
||||
mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/prompts";
|
||||
};
|
||||
xdg.configFile."opencode/context" = mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/context";
|
||||
};
|
||||
xdg.configFile."opencode/commands" = mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/commands";
|
||||
};
|
||||
xdg.configFile."opencode/prompts" = mkIf (cfg.agentsInput != null) {
|
||||
source = "${cfg.agentsInput}/prompts";
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user