diff --git a/pkgs/by-name/an/antigravity/package.nix b/pkgs/by-name/an/antigravity/package.nix index c8a434e1c7ef..c1fcd590fbba 100644 --- a/pkgs/by-name/an/antigravity/package.nix +++ b/pkgs/by-name/an/antigravity/package.nix @@ -4,6 +4,9 @@ callPackage, vscode-generic, fetchurl, + buildFHSEnv, + writeShellScript, + coreutils, commandLineArgs ? "", useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin, }: @@ -40,6 +43,29 @@ callPackage vscode-generic { sourceRoot = if hostPlatform.isDarwin then "Antigravity.app" else "Antigravity"; + # When running inside an FHS environment, try linking Google Chrome or Chromium + # to the hardcoded Playwright search path: /opt/google/chrome/chrome + buildFHSEnv = + args: + buildFHSEnv ( + args + // { + extraBuildCommands = (args.extraBuildCommands or "") + '' + mkdir -p "$out/opt/google/chrome" + ''; + extraBwrapArgs = (args.extraBwrapArgs or [ ]) ++ [ "--tmpfs /opt/google/chrome" ]; + runScript = writeShellScript "antigravity-wrapper" '' + for candidate in google-chrome-stable google-chrome chromium-browser chromium; do + if target=$(command -v "$candidate"); then + ${coreutils}/bin/ln -sf "$target" /opt/google/chrome/chrome + break + fi + done + exec ${args.runScript} "$@" + ''; + } + ); + tests = { }; updateScript = ./update.sh;