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

This commit is contained in:
kirillrdy
2025-11-21 05:12:29 +00:00
committed by GitHub
+26
View File
@@ -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;