Revert "Populate PATH files to discover installed CLIs"

This reverts commit 18d88781a88b8781913cf5a8b680dfb38eabf7e4.
This commit is contained in:
Christopher Tam 2026-05-03 18:27:57 -04:00
parent 641bb71567
commit d02ea994e6
3 changed files with 4 additions and 80 deletions

View file

@ -55,41 +55,10 @@
}
'';
# systemd --user units (and macOS launchd agents) start with a minimal
# default PATH that excludes Home Manager and NixOS user-profile bin
# directories. The daemon scans `process.env.PATH` for agent CLIs, so
# without an explicit PATH the UI reports "no agents detected" even when
# claude / codex / opencode / ... are installed.
#
# `${config.home.profileDirectory}/bin` covers both standalone HM
# (~/.nix-profile/bin) and HM-as-NixOS-module (/etc/profiles/per-user/<u>/bin).
# The remaining Linux entries pick up wrappers, the system profile, and
# the default Nix profile. Darwin gets the standard launchd PATH.
daemonPathEntries =
["${config.home.profileDirectory}/bin"]
++ lib.optionals pkgs.stdenv.isLinux [
"/run/wrappers/bin"
"/etc/profiles/per-user/${config.home.username}/bin"
"/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin"
"/usr/local/bin"
"/usr/bin"
"/bin"
]
++ lib.optionals pkgs.stdenv.isDarwin [
"/usr/local/bin"
"/usr/bin"
"/bin"
"/usr/sbin"
"/sbin"
]
++ cfg.extraBinPaths;
daemonEnv =
{
OD_PORT = toString cfg.port;
OD_DATA_DIR = toString cfg.dataDir;
PATH = lib.concatStringsSep ":" daemonPathEntries;
}
// cfg.extraEnv;

View file

@ -27,14 +27,9 @@
"copilot"
];
# `pkgs.system` is a legacy alias removed when consumers set
# `nixpkgs.config.allowAliases = false`. Use the canonical attribute
# path so the module evaluates under both default and strict configs.
systemAttr = pkgs.stdenv.hostPlatform.system;
flakePackages =
if flake ? packages.${systemAttr}
then flake.packages.${systemAttr}
if flake ? packages.${pkgs.system}
then flake.packages.${pkgs.system}
else {};
in {
enable = lib.mkEnableOption "Open Design local-first design product daemon";
@ -43,7 +38,7 @@ in {
type = lib.types.package;
default =
flakePackages.daemon or (throw
"open-design: no daemon package available for ${systemAttr}; set services.open-design.package explicitly");
"open-design: no daemon package available for ${pkgs.system}; set services.open-design.package explicitly");
defaultText = lib.literalExpression "open-design.packages.\${pkgs.system}.daemon";
description = "The Open Design daemon package providing the `od` binary.";
};
@ -115,27 +110,6 @@ in {
'';
};
extraBinPaths = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = ''
Extra absolute directories to prepend to the daemon service's
PATH. The daemon discovers agent CLIs (claude, codex, gemini,
opencode, ...) by scanning `process.env.PATH` at runtime, but
systemd unit and macOS launchd agent invocations launch with a
minimal default PATH that excludes Home Manager / NixOS user
profiles so without entries here the daemon will report
"no agents detected" even when the CLIs are installed.
Both modules pre-populate PATH with sensible defaults for their
context (Home Manager: the user's HM profile and, on NixOS, the
per-user/system profile dirs; NixOS: the system profile and
wrapper dirs). Use this option to add additional locations
(custom installs under `/opt`, project-local `bin/`, etc.).
'';
example = lib.literalExpression ''[ "/opt/agents/bin" ]'';
};
agents = lib.mkOption {
type = lib.types.listOf (lib.types.enum supportedAgents);
default = [];
@ -191,7 +165,7 @@ in {
type = lib.types.package;
default =
flakePackages.web or (throw
"open-design: no web package available for ${systemAttr}; set services.open-design.webFrontend.package explicitly");
"open-design: no web package available for ${pkgs.system}; set services.open-design.webFrontend.package explicitly");
defaultText = lib.literalExpression "open-design.packages.\${pkgs.system}.web";
description = "Built static export to serve (Next.js out/ tree).";
};

View file

@ -57,29 +57,10 @@
LockPersonality = true;
};
# System systemd units launch with a minimal default PATH that excludes
# NixOS profile dirs where agent CLIs live. The daemon scans
# `process.env.PATH` to discover them, so an explicit PATH is required
# or the UI reports "no agents detected". The service runs as a system
# user, so per-user profile dirs aren't included by default — operators
# who install agents into a specific location should add it via
# `services.open-design.extraBinPaths`.
daemonPathEntries =
[
"/run/wrappers/bin"
"/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin"
"/usr/local/bin"
"/usr/bin"
"/bin"
]
++ cfg.extraBinPaths;
daemonEnvironment =
{
OD_PORT = toString cfg.port;
OD_DATA_DIR = toString cfg.dataDir;
PATH = lib.concatStringsSep ":" daemonPathEntries;
}
// cfg.extraEnv;