diff --git a/modules/home-manager/programs/copilot-fix.nix b/modules/home-manager/programs/copilot-fix.nix index a28c37b..18e105e 100644 --- a/modules/home-manager/programs/copilot-fix.nix +++ b/modules/home-manager/programs/copilot-fix.nix @@ -1,11 +1,20 @@ -{ pkgs, ... }: +{ pkgs }: pkgs.github-copilot-cli.overrideAttrs (old: { postFixup = (old.postFixup or "") + '' if [ -f "$out/bin/.copilot-wrapped" ]; then - echo "Patching copilot wrapper to remove --no-warnings..." - substituteInPlace "$out/bin/.copilot-wrapped" \ - --replace "--no-warnings" "" + echo "Patching copilot wrapper (binary-safe)..." + + tmpfile=$(mktemp) + + # remove the offending flag safely + cat "$out/bin/.copilot-wrapped" \ + | tr -d '\000' \ + | sed 's/--no-warnings//g' \ + > "$tmpfile" + + chmod +x "$tmpfile" + mv "$tmpfile" "$out/bin/.copilot-wrapped" fi ''; })