programs.git.enable + harness PATH tracks systemPackages

- harness-base.nix: switch to programs.git for declarative gitconfig.
- agent + manager service path = /run/current-system/sw → agents pick up
  new packages from their own agent.nix without harness edits.
- generated applied/<name>/flake.nix overrides programs.git.config.user
  (no more raw etc.gitconfig collision).
This commit is contained in:
müde 2026-05-15 16:16:14 +02:00
parent e1289a3e4c
commit 0f0e242906
4 changed files with 34 additions and 31 deletions

View file

@ -243,13 +243,10 @@ pub async fn setup_applied(
modules = [ modules = [
./agent.nix ./agent.nix
{{ {{
environment.etc."gitconfig".text = '' programs.git.config.user = {{
[user] name = "{name}";
name = {name} email = "{name}@hyperhive";
email = {name}@hyperhive }};
[init]
defaultBranch = main
'';
systemd.services.{service}.environment = {{ systemd.services.{service}.environment = {{
HIVE_PORT = "{port}"; HIVE_PORT = "{port}";
HIVE_LABEL = "{name}"; HIVE_LABEL = "{name}";

View file

@ -6,13 +6,13 @@
description = "hive-ag3nt harness"; description = "hive-ag3nt harness";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
# `claude` for the turn loop + `bash` for claude's Bash tool. systemd # systemd units get a minimal PATH by default and don't inherit
# units get a minimal PATH by default; entries in # `environment.systemPackages`. Pointing at `/run/current-system/sw`
# `environment.systemPackages` aren't on it. # gives the harness (and any tools claude shells out to via Bash)
path = [ # access to everything declared in `systemPackages` — including
pkgs.claude-code # anything an agent adds to its own `agent.nix` — without having to
pkgs.bashInteractive # touch the service definition.
]; path = [ "/run/current-system/sw" ];
environment.SHELL = "${pkgs.bashInteractive}/bin/bash"; environment.SHELL = "${pkgs.bashInteractive}/bin/bash";
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.hyperhive}/bin/hive-ag3nt serve"; ExecStart = "${pkgs.hyperhive}/bin/hive-ag3nt serve";

View file

@ -13,23 +13,28 @@
hyperhive hyperhive
claude-code claude-code
bashInteractive bashInteractive
git
coreutils-full coreutils-full
]; ];
# Git is needed by claude's Bash tool (for the agent <-> manager config
# request flow) and by hive-c0re's own setup_applied / setup_proposed.
# `programs.git.enable` installs the binary + manages `/etc/gitconfig`
# declaratively so the inline module in `applied/<name>/flake.nix` can
# override `user.name` / `user.email` per agent without fighting a raw
# `environment.etc."gitconfig"` block.
programs.git = {
enable = true;
config = {
user = {
name = "hyperhive";
email = "hyperhive@local";
};
init.defaultBranch = "main";
};
};
# claude's Bash tool refuses to run without a POSIX shell + $SHELL set. # claude's Bash tool refuses to run without a POSIX shell + $SHELL set.
environment.variables.SHELL = "${pkgs.bashInteractive}/bin/bash"; environment.variables.SHELL = "${pkgs.bashInteractive}/bin/bash";
# Default gitconfig for any commits the harness makes. The per-agent
# `applied/<name>/flake.nix` overrides this with the agent's own name +
# email; this fallback only kicks in if the container is built straight
# from `agent-base` / `manager` without the per-agent extension.
environment.etc."gitconfig".text = ''
[user]
name = hyperhive
email = hyperhive@local
[init]
defaultBranch = main
'';
system.stateVersion = "25.11"; system.stateVersion = "25.11";
} }

View file

@ -15,10 +15,11 @@
HIVE_LABEL = "hm1nd"; HIVE_LABEL = "hm1nd";
SHELL = "${pkgs.bashInteractive}/bin/bash"; SHELL = "${pkgs.bashInteractive}/bin/bash";
}; };
path = [ # See note in agent-base.nix — `/run/current-system/sw` makes the
pkgs.claude-code # harness service PATH track `environment.systemPackages` so anything
pkgs.bashInteractive # an agent adds to its own `agent.nix` is visible without editing the
]; # service definition.
path = [ "/run/current-system/sw" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.hyperhive}/bin/hive-m1nd serve"; ExecStart = "${pkgs.hyperhive}/bin/hive-m1nd serve";
Restart = "on-failure"; Restart = "on-failure";