diff --git a/pkgs/antigravity-acp/default.nix b/pkgs/antigravity-acp/default.nix index eca9bfa9c9..8837ed7928 100644 --- a/pkgs/antigravity-acp/default.nix +++ b/pkgs/antigravity-acp/default.nix @@ -82,6 +82,39 @@ stdenv.mkDerivation { --set-default SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" ''; + # Runtime smoke check (issue #4759): autoPatchelfHook rewrites these + # binaries on the current nixpkgs pin, and patchelf 0.19.x rewrites + # corrupt single-file executables (the t3 Node SEA segfault, #4884). + # agy_acp_server.par is exactly that shape -- a dynamically linked + # single-file PAR executable -- and this derivation previously had no + # install check that would catch such corruption. + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + export HOME="$TMPDIR" + # localharness_external is a Go binary: --help prints usage and exits + # 2. A SIGSEGV (139, the corruption signature) fails this test. + "$out/bin/localharness_external" --help > /dev/null 2>&1 || [ $? -eq 2 ] + # agy_acp_server.par itself cannot execute in the build sandbox: its + # tcmalloc startup aborts on the sandbox's restricted CPU view + # (third_party/tcmalloc NumCPUs CHECK) before main; on a host it + # starts and answers --help. What patchelf can corrupt is the ELF + # loading path -- the #4759 failure segfaulted inside ld.so before + # main ever ran -- so verify that path through the dynamic linker's + # --list mode, which resolves the patched interpreter and RUNPATH + # without running program initializers. Two corrections from review: + # on Linux the public path is the makeBinaryWrapper launcher that + # postFixup's wrapProgram installs, and the patchelf-rewritten + # payload is the hidden .agy_acp_server.par-wrapped executable next + # to it, so --list the payload, not the launcher; and the check is + # ELF-specific, so it is Linux-only (Darwin's /usr/lib/dyld cannot + # be invoked this way). + ${lib.optionalString stdenv.hostPlatform.isLinux '' + "${stdenv.cc.bintools.dynamicLinker}" --list "$out/bin/.agy_acp_server.par-wrapped" > /dev/null + ''} + runHook postInstallCheck + ''; + meta = { description = "Google's AI coding agent. Official ACP server powered by Antigravity"; homepage = "https://antigravity.google/docs/ide/extensions";