Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2324,6 +2324,32 @@
touch $out
'';

# The Mac's goose wiring (workstation-6w7i.17), checked at EVAL time on the
# Linux CI leg (a Linux builder cannot build the darwin derivations, so this
# reads module values only, and none that force home.packages: that
# imports a darwin derivation from devenv, IFD the Linux leg cannot build). Pins what the Mac had wrong before: pigeon
# talking to bare goose at :4080, no owner id for topic-bound goose
# sessions, no honkd, no roles. The launchd
# scripts themselves are covered by checks.aarch64-darwin.home-mac on the Mac.
darwin-goose-wiring = let
hm = self.homeConfigurations.${mac.hostname}.config;
agents = hm.launchd.agents;
pigeonEnv = agents.pigeon-daemon.config.EnvironmentVariables;
lib = devboxPkgs.lib;
checks = {
"pigeon -> honkd :4280" = pigeonEnv.PIGEON_GOOSE_ACP_URL == "ws://127.0.0.1:4280/acp";
"owner id set" = (pigeonEnv.PIGEON_PULL_ALLOWED_USER_IDS or "") != "";
"honkd agent enabled" = agents ? honkd && agents.honkd.enable;
"goose-serve agent enabled" = agents.goose-serve.enable;
"roles deployed" = hm.home.file ? ".config/goose/subagent-roles";
};
failed = builtins.attrNames (lib.filterAttrs (_: ok: !ok) checks);
in
assert lib.assertMsg (failed == [ ]) "darwin-goose-wiring failed: ${lib.concatStringsSep "; " failed}";
devboxPkgs.runCommand "darwin-goose-wiring" { } ''
echo "darwin-goose-wiring: ${toString (builtins.length (builtins.attrNames checks))} passed" > $out
'';

# oc-mcp-enable grants a RUNNING session an MCP server (connect + a
# session-scoped allow rule). The suite pins the two things a silent
# regression would break: the `<server>_*` permission pattern (a wrong
Expand Down
2 changes: 1 addition & 1 deletion pkgs/goose-roles/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
runCommand "goose-roles" {
nativeBuildInputs = [ (python3.withPackages (ps: [ ps.pyyaml ])) goose ];
meta = {
platforms = lib.platforms.linux;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
} ''
python3 ${./gen_goose_roles.py} --agents-dir ${agentsDir} --out $out \
Expand Down
22 changes: 19 additions & 3 deletions pkgs/goose/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@
# Release assets are byte-for-byte what upstream's workflow produces for the
# patched source (gnu, default features), so measurements of upstream behaviour
# still hold outside the patched lines.
#
# DARWIN (the Mac, workstation-6w7i.17). The aarch64-apple-darwin asset is
# upstream's bundle-macos.yml CLI build of the same patched source (default
# features, unsigned: a Nix fetch sets no quarantine attribute and the linker's
# ad-hoc signature is all Apple Silicon needs). Releases from patched-1.54.0.16
# on carry it; patched-1.54.0.15's was backfilled onto the existing release by
# the fork's patched-release-darwin.yml without touching its Linux assets.
# On the Mac, goose-serve (launchd, users/dev/home.darwin.nix) and the CLI
# (users/dev/goose-config.nix) run this package.

{ lib
, stdenv
Expand Down Expand Up @@ -164,6 +173,10 @@ let
asset = "goose-x86_64-unknown-linux-gnu.tar.gz";
hash = "sha256-Bwkat3rT+Oo0whw5Qwsn0LlKe7EfkZxAkDa4cauj/9M=";
};
"aarch64-darwin" = {
asset = "goose-aarch64-apple-darwin.tar.gz";
hash = "sha256-h7+nLFAHsvsT8/Fc2LrYWdTgIni0GO3ehhd5Y8CKhH8=";
};
};

platformInfo =
Expand All @@ -179,8 +192,10 @@ stdenv.mkDerivation {
inherit (platformInfo) hash;
};

nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ stdenv.cc.cc.lib ];
# ELF only. The darwin binary links only system libraries (/usr/lib,
# /System), which every macOS has at the same paths.
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ];

dontConfigure = true;
dontBuild = true;
Expand All @@ -202,7 +217,8 @@ stdenv.mkDerivation {

# autoPatchelfHook rewrites the interpreter to the nix loader, so this must
# run to confirm the result is actually executable -- a patchelf miss is
# invisible until runtime otherwise. Cheap, and it is the whole point of
# invisible until runtime otherwise. On darwin it is the check that the
# unsigned binary execs at all. Cheap, and it is the whole point of
# packaging rather than pointing at $HOME.
doInstallCheck = true;
installCheckPhase = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/ro-shell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ python3.pkgs.buildPythonApplication {
meta = {
description = "Read-only shell MCP server for goose subagent roles";
mainProgram = "ro-shell";
platforms = lib.platforms.linux;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
17 changes: 9 additions & 8 deletions users/dev/goose-config.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Shared goose configuration for Linux hosts (devbox and cloudbox).
# Ensures both hosts run the packaged goose CLI on PATH, warn on stray hand-installed
# Shared goose configuration for every host (devbox, cloudbox, and the Mac since
# workstation-6w7i.17). Ensures each host runs the packaged goose CLI on PATH, warn on stray hand-installed
# binaries, and enforce platform extension defaults and subagent roles policy
# on ~/.config/goose/config.yaml without clobbering writable runtime state.
{ config, pkgs, lib, isCloudbox, isDevbox, ... }:
{ config, pkgs, lib, isCloudbox, isDevbox, isDarwin, ... }:

let
isLinuxHost = isCloudbox || isDevbox;
isGooseHost = isCloudbox || isDevbox || isDarwin;

# goose: the SAME package goose-serve runs (hosts/{cloudbox,devbox}, pkgs/goose), so the
# goose: the SAME package goose-serve runs (hosts/{cloudbox,devbox}, the launchd agent in
# users/dev/home.darwin.nix, pkgs/goose), so the
# interactive CLI, every unattended `goose run` and goose-serve all run one binary. Bound to
# its own name: `pkgs.goose` in nixpkgs is the pressly/goose DATABASE MIGRATION TOOL.
gooseCli = pkgs.callPackage ../../pkgs/goose { };
Expand Down Expand Up @@ -106,7 +107,7 @@ let

gooseConfigEnforce = pkgs.callPackage ../../pkgs/goose-config-enforce { };
in
lib.mkIf isLinuxHost {
lib.mkIf isGooseHost {
home.packages = [ gooseCli ];

# One goose on this host (see gooseCli above). Login and interactive shells put
Expand Down Expand Up @@ -138,14 +139,14 @@ lib.mkIf isLinuxHost {
text = ''
# goose config.yaml: what is managed and where

This file is generated by home-manager (workstation users/dev/${if isCloudbox then "home.cloudbox.nix" else "goose-config.nix"}).
This file is generated by home-manager (workstation users/dev/goose-config.nix).
Do not edit it here.

`config.yaml` itself stays writable, because goose writes it: `goose configure`,
extension toggles and its own migrations. On every home-manager switch,
`goose-config-enforce` sets `extensions.<key>.enabled` to match
`gooseExtensionsEnabled` and top-level settings to match `gooseConfigSettings`
in ${if isCloudbox then "home.cloudbox.nix" else "goose-config.nix"}, leaving everything else alone. An extension or setting
in goose-config.nix, leaving everything else alone. An extension or setting
toggled by hand is therefore reverted on the next switch. To change
the default set, change it in workstation.

Expand Down
7 changes: 5 additions & 2 deletions users/dev/goose-roles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# GOOSE_SUBAGENT_ROLES_DIR: /home/dev/.config/goose/subagent-roles/roles
# GOOSE_SUBAGENT_DEFAULT_RECIPE: /home/dev/.config/goose/subagent-roles/unscoped.yaml
# Requires goose >= patched-1.54.0.10. Design: docs/plans/2026-10-20-goose-subagent-roles-design.md
{ lib, localPkgs, isCloudbox, isDevbox, ... }:
{ lib, localPkgs, isCloudbox, isDevbox, isDarwin, ... }:

#
# PROVIDER IS PER HOST. A role's settings.goose_provider outranks every other
Expand All @@ -21,7 +21,10 @@
# GCP_VERTEX_GEMINI_HOST in hosts/cloudbox). devbox: all Opus. Omitting
# goose_provider instead would pair the parent's provider (e.g. openai) with the
# roles' model, which fails.
lib.mkIf (isCloudbox || isDevbox) {
# The Mac gets cloudbox's build: its goose-serve is on gcp_vertex_ai too, Claude
# via its own cfp when the Max pool is seeded, Gemini straight to Vertex
# (users/dev/home.darwin.nix, workstation-6w7i.17).
lib.mkIf (isCloudbox || isDevbox || isDarwin) {
home.file.".config/goose/subagent-roles".source =
if isDevbox
then localPkgs.goose-roles.override { provider = "anthropic"; }
Expand Down
Loading
Loading