Watch
0
0
Fork
You've already forked hyperhive
0

agent claude-code is built without its alsa-lib LD_LIBRARY_PATH wrapper

This commit is contained in:
atlas 2026-10-19 21:37:47 +02:00
commit cac634cb65
3 changed files with 31 additions and 2 deletions

View file

@ -242,7 +242,7 @@ in
++ [
(
if config.services.hyperhive.agent.claudeCodePath == null then
pkgs.claude-code
import ../claude-code-no-alsa.nix lib pkgs.claude-code
else
# Host-pinned claude: a symlink farm around a path the
# container was handed as text. It has to be a derivation —

View file

@ -0,0 +1,25 @@
# `claude-code` without the `--prefix LD_LIBRARY_PATH` alsa-lib entry
# nixpkgs adds to its wrapper. The wrapper exports the variable into
# claude's own environment, so every shell claude spawns inherits an
# alsa-lib `lib` dir that shadows the libraries newer nixpkgs binaries
# (headless chromium) were built against. Agents have no audio device,
# so alsa-lib is not needed. Every other wrapper flag stays.
#
# nixpkgs gives no switch for it (`alsa-lib` only feeds that one
# `makeLibraryPath`), so the line is dropped from `installPhase`. A
# package whose `installPhase` has no such line comes back unchanged.
lib: claudeCode:
let
marker = "--prefix LD_LIBRARY_PATH";
dropMarker =
phase:
lib.concatStringsSep "\n" (
builtins.filter (l: !(lib.hasInfix marker l)) (lib.splitString "\n" phase)
);
in
if lib.hasInfix marker (claudeCode.installPhase or "") then
claudeCode.overrideAttrs (old: {
installPhase = dropMarker old.installPhase;
})
else
claudeCode

View file

@ -109,7 +109,11 @@ let
# anything that drops it. The failure mode is a garbage-collected
# `claude` and a hive that can't take a turn, weeks after the commit
# that caused it.
claude_code_path = controllerCfg.claudeCodePackage;
claude_code_path =
if controllerCfg.claudeCodePackage == null then
null
else
import ../../claude-code-no-alsa.nix lib controllerCfg.claudeCodePackage;
dashboard_port = controllerCfg.dashboardPort;
agent_cpu_quota = cfg.agentCpuQuota;
agent_memory_max = cfg.agentMemoryMax;