Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/nix/claude-code-no-alsa.nix

25 lines
991 B
Nix

# `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