Files
nixos-config/home/yolo/services.nix
T
Miguel Palhas 914753fb55
CI / lint (push) Successful in 31s
CI / eval (push) Failing after 33s
fix(yolo): drop removed services.maestro.web.enable
maestro's daemon serves the browser UI on daemon.bind_addr; the option is now
a mkRemovedOptionModule, so every flake bump failed to build. config.toml moves
the daemon to 0.0.0.0:7070 and Traefik's maestro router now points there.
2026-09-02 19:31:38 +01:00

98 lines
3.6 KiB
Nix

{
pkgs,
inputs,
...
}:
# The user services this box exists to run.
#
# maestro and rev come from their own flakes, so nix owns the build as well as
# the unit. aoe-web is still the odd one out: its unit is defined here and the
# binary comes from the flake input.
let
# A user unit gets almost no PATH by default; these are the profile dirs the
# original units got for free from the system PATH on Ubuntu.
toolPath = "%h/.local/bin:%h/.nix-profile/bin:/etc/profiles/per-user/naps62/bin:/run/current-system/sw/bin";
sem = inputs.sem.packages.${pkgs.system}.default;
aoe = inputs.agent-of-empires.packages.${pkgs.system}.aoe-with-web;
in
{
# sem is here as well as on rev's unit: the shell uses it directly too.
home.packages = [
sem
# ACP adapter aoe's structured (web) sessions spawn as `claude-agent-acp`.
pkgs.claude-agent-acp
];
# maestro's and rev's units come from their flake modules, not from the
# hand-written set below.
#
# settings stays empty on purpose: ~/.config/maestro/config.toml is a
# hand-edited plain file, not nix-generated (module skips it iff `{}`).
# There is no `web.enable`: the daemon serves the UI on `daemon.bind_addr`.
services.maestro.enable = true;
# Everything under ~, three levels deep — the worktrees live at
# ~/<area>/<repo>/worktrees/<name>. sem gives entity-level diffs; without it
# rev falls back to line diffs.
services.rev = {
enable = true;
roots = [ "%h" ];
depth = 3;
semBin = "${sem}/bin/sem";
};
# One endpoint for every repo this config pins. All three apply straight
# away: a maestro restart drops the daemon but not the sessions it manages,
# so the interactive shells on this box survive it.
services.nixAutodeploy = {
enable = true;
flake = "/home/naps62/tea/nixos-config";
environmentFile = "%h/.config/nix-autodeploy/env";
repos = {
"yolo/rev".input = "rev";
"yolo/agent-skills".input = "agent-skills";
"naps62/maestro".input = "maestro";
};
};
systemd.user.services = {
aoe-web = {
Unit = {
Description = "aoe serve — Agent of Empires web dashboard";
After = [ "network.target" ];
# MUST stay 0: at RestartSec=2 a fast-crashing aoe burns the default
# 5-starts-per-10s budget, and systemd parks the unit in `failed` until
# a manual `systemctl --user reset-failed`.
StartLimitIntervalSec = 0;
};
Service = {
Type = "simple";
WorkingDirectory = "%h";
# The fork removed dashboard auth entirely, so there is no --auth flag
# any more — the reverse proxy is the only access gate. --allowed-host
# is what makes the rebinding gate accept a hostname under a wildcard
# bind (an IP literal needs no flag).
ExecStart = "${aoe}/bin/aoe serve --host 0.0.0.0 --port 8080 --behind-proxy --allowed-host aoe.n62.casa";
# TMUX_TMPDIR keeps the daemon on the same tmux server the shell and
# TUI use, instead of a second one under /tmp (same bug pr-daemon had).
Environment = [
"PATH=${toolPath}"
"TMUX_TMPDIR=%t"
];
Restart = "always";
RestartSec = 2;
# If this unit boots before any shell, the shared tmux server lands in
# its cgroup; the default control-group kill would take every session
# down on restart.
KillMode = "process";
};
Install.WantedBy = [ "default.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.