Unverified Commit a186fb5b authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

antigravity-fhs: support auto-discovery of google-chrome/chromium (#463233)

parents b60ce0e7 7d433632
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -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;