From ba5b618e49bad804fe7cc97d2b450bc545fc65fd Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Wed, 19 Aug 2026 22:20:44 +0100 Subject: [PATCH] refactor(yolo): take the agent-skills units from their own module pr-daemon, hourlog and week-review are defined by the agent-skills home-manager module now, next to the scripts they run; this host just enables them. Co-Authored-By: Claude Opus 5 (1M context) --- flake.lock | 8 ++-- home/yolo/default.nix | 9 +++- home/yolo/services.nix | 94 ++---------------------------------------- 3 files changed, 15 insertions(+), 96 deletions(-) diff --git a/flake.lock b/flake.lock index feb6b1e..4dafcd9 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ }, "agent-skills": { "locked": { - "lastModified": 1787148831, - "narHash": "sha256-OGVxFCa4nkWJwieNVD0qxKedf22Bi2snCTXhsFv2m5s=", + "lastModified": 1787174393, + "narHash": "sha256-nMxPQbVaK9cdsidGP78VOxUKTAHRKHGQEzkRbKxuivY=", "ref": "refs/heads/main", - "rev": "6f057568704059bed1d25f21fcc35021df9611b1", - "revCount": 52, + "rev": "465b20a7c64c84c645acbd94548c36c36decbfe4", + "revCount": 66, "type": "git", "url": "https://git.naps.pt/yolo/agent-skills.git" }, diff --git a/home/yolo/default.nix b/home/yolo/default.nix index fabb211..9c8b943 100644 --- a/home/yolo/default.nix +++ b/home/yolo/default.nix @@ -64,7 +64,14 @@ in }; }; - programs.agentSkills.machine = "yolo"; + # This is the one box that runs the agent-skills units; each starts a session, + # so a second machine enabling them would run the same job twice. + programs.agentSkills = { + machine = "yolo"; + prDaemon.enable = true; + hourlog.enable = true; + weekReview.enable = true; + }; programs.nh.flake = "/home/naps62/tea/nixos-config"; # Idle lock and dpms-off blank the virtual output: Sunshine then captures a diff --git a/home/yolo/services.nix b/home/yolo/services.nix index 9205e3d..5bbd4c3 100644 --- a/home/yolo/services.nix +++ b/home/yolo/services.nix @@ -92,96 +92,8 @@ in }; Install.WantedBy = [ "default.target" ]; }; - - pr-daemon = { - Unit = { - Description = "pr-daemon — watches GitHub/Gitea PRs and routes them to aoe sessions"; - Documentation = [ "https://git.naps.pt/yolo/agent-skills" ]; - After = [ "network.target" ]; - # Both are required and neither is in the nix store: the config names - # the repos, the env file holds the read-only forge tokens. Missing - # config would crash-loop against Restart=always. - ConditionPathExists = [ - "%h/.config/reviewer/config.json" - "%h/.config/reviewer/env" - ]; - # Same restart-budget trap as `rev` above. - StartLimitIntervalSec = 0; - }; - Service = { - Type = "simple"; - WorkingDirectory = "%h"; - ExecStart = "${pkgs.bun}/bin/bun %h/tea/agent-skills/bin/reviewer-poll.ts"; - EnvironmentFile = "%h/.config/reviewer/env"; - # aoe and git come from the profile dirs, not from a user unit's default - # PATH. TMUX_TMPDIR keeps the sessions it starts on the same tmux server - # the shell and TUI use, instead of a second one under /tmp. - Environment = [ - "PATH=${toolPath}" - "TMUX_TMPDIR=%t" - ]; - Restart = "always"; - RestartSec = 5; - # The agent tmux sessions this daemon starts land in its cgroup, so the - # default control-group kill takes every running agent down with it. - KillMode = "process"; - }; - Install.WantedBy = [ "default.target" ]; - }; - - hourlog = { - Unit = { - Description = "Start the Friday hour log in a tmux session"; - Documentation = [ "https://git.naps.pt/yolo/agent-skills" ]; - ConditionPathIsDirectory = "%h/tea/agent-skills"; - }; - Service = { - Type = "oneshot"; - ExecStart = "%h/tea/agent-skills/bin/hourlog-session.sh"; - Environment = [ "PATH=${toolPath}" ]; - # This unit may be what starts the tmux server; the default cgroup kill - # would take it back down as soon as ExecStart returns. - KillMode = "process"; - }; - }; - - week-review = { - Unit = { - Description = "Start the weekly agent-skills review in a tmux session"; - Documentation = [ "https://git.naps.pt/yolo/agent-skills" ]; - ConditionPathIsDirectory = "%h/tea/agent-skills"; - }; - Service = { - Type = "oneshot"; - ExecStart = "%h/tea/agent-skills/bin/week-review-session.sh"; - Environment = [ "PATH=${toolPath}" ]; - KillMode = "process"; - }; - }; }; - - systemd.user.timers = { - hourlog = { - Unit.Description = "Friday hour log, 18:00 Europe/Lisbon"; - Timer = { - # Zone suffix pinned because the machine clock is UTC; keeps it at 18:00 - # wall time across DST. - OnCalendar = "Fri 18:00 Europe/Lisbon"; - Persistent = true; - AccuracySec = "1min"; - }; - Install.WantedBy = [ "timers.target" ]; - }; - - week-review = { - Unit.Description = "Weekly agent-skills review, Fridays 17:00 Europe/Lisbon"; - Timer = { - OnCalendar = "Fri 17:00 Europe/Lisbon"; - Persistent = true; - AccuracySec = "1min"; - }; - Install.WantedBy = [ "timers.target" ]; - }; - }; - } +# pr-daemon, hourlog and week-review are not here: their units ship with the +# scripts they run, in the agent-skills module. This host opts in with +# programs.agentSkills.*.enable in home/yolo/default.nix.