Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,12 @@
github = "bohanubis";
githubId = 77834479;
};
BohdanTkachenko = {
email = "bohdan@tkachenko.dev";
github = "BohdanTkachenko";
githubId = 929598;
name = "Bohdan Tkachenko";
};
bohreromir = {
github = "bohreromir";
githubId = 40412303;
Expand Down
188 changes: 188 additions & 0 deletions pkgs/by-name/an/antigravity-hub/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
alsa-lib,
asar,
at-spi2-atk,
at-spi2-core,
atk,
autoPatchelfHook,
copyDesktopItems,
cairo,
cups,
dbus,
expat,
fetchurl,
fontconfig,
freetype,
gdk-pixbuf,
glib,
gsettings-desktop-schemas,
gtk3,
lib,
libdrm,
libgbm,
libGL,
libglvnd,
libnotify,
libpulseaudio,
libsecret,
libuuid,
libx11,
libxcb,
libxcomposite,
libxcursor,
libxdamage,
libxext,
libxfixes,
libxi,
libxkbcommon,
libxml2,
libxrandr,
libxrender,
libxshmfence,
libxt,
libxtst,
makeDesktopItem,
makeWrapper,
mesa,
nspr,
nss,
pango,
passwordStore ? "basic",
stdenv,
systemd,
vulkan-loader,
wayland,
xdg-utils,
}:

let
desktopLibs = [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gsettings-desktop-schemas
gtk3
libdrm
libgbm
libGL
libglvnd
libnotify
libpulseaudio
libsecret
libuuid
libx11
libxcb
libxcomposite
libxcursor
libxdamage
libxext
libxfixes
libxi
libxkbcommon
libxml2
libxrandr
libxrender
libxshmfence
libxt
libxtst
mesa
nspr
nss
pango
stdenv.cc.cc
systemd
vulkan-loader
wayland
];

sources = builtins.fromJSON (builtins.readFile ./sources.json);
systemSource =
sources.sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation {
pname = "antigravity-hub";
version = sources.version;

src = fetchurl {
url = systemSource.url;
hash = systemSource.sha256;
};

sourceRoot = systemSource.sourceRoot;

__structuredAttrs = true;
strictDeps = true;

nativeBuildInputs = [
asar
autoPatchelfHook
copyDesktopItems
makeWrapper
];

buildInputs = desktopLibs;

desktopItems = [
(makeDesktopItem {
name = "antigravity-hub";
desktopName = "Antigravity";
comment = "Antigravity 2 - Agent-first development platform";
exec = "antigravity %U";
icon = "antigravity";
terminal = false;
type = "Application";
categories = [ "Development" ];
startupWMClass = "antigravity";
})
];

installPhase = ''
runHook preInstall
mkdir -p $out/share/antigravity
cp -r . $out/share/antigravity/

mkdir -p $out/bin
makeWrapper $out/share/antigravity/antigravity $out/bin/antigravity \
--add-flags "--no-sandbox" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
${lib.optionalString (passwordStore != "") "--add-flags --password-store=${passwordStore}"} \
--prefix PATH : ${lib.makeBinPath [ xdg-utils ]} \
--suffix PATH : /nix/store \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath desktopLibs} \
--prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}"

asar extract-file resources/app.asar icon.png
install -Dm644 icon.png $out/share/icons/hicolor/512x512/apps/antigravity.png

runHook postInstall
'';

passthru.updateScript = ./update.sh;

meta = {
description = "Desktop environment for managing multiple autonomous agents across independent projects.";
homepage = "https://antigravity.google";
changelog = "https://antigravity.google/changelog";
downloadPage = "https://antigravity.google/download";
license = lib.licenses.unfree;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "antigravity";
maintainers = with lib.maintainers; [
BohdanTkachenko
];
};
}
15 changes: 15 additions & 0 deletions pkgs/by-name/an/antigravity-hub/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.2.1",
"sources": {
"x86_64-linux": {
"url": "https://storage.googleapis.com/antigravity-public/antigravity-hub/2.2.1-5287492581195776/linux-x64/Antigravity.tar.gz",
"sha256": "sha256-prp3BG+SqhziHYoMZ0lUca9MK+EbpiTl2TWCGWmyCYk=",
"sourceRoot": "Antigravity-x64"
},
"aarch64-linux": {
"url": "https://storage.googleapis.com/antigravity-public/antigravity-hub/2.2.1-5287492581195776/linux-arm/Antigravity.tar.gz",
"sha256": "sha256-+HaGr1YuCYxyoyy+O2B1R6qxp9TtqSh945YhMEMDNVY=",
"sourceRoot": "Antigravity-arm64"
}
}
}
110 changes: 110 additions & 0 deletions pkgs/by-name/an/antigravity-hub/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq yq-go nix coreutils cacert

set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
SOURCE_JSON="$DIR/sources.json"

MANIFEST_BASE_URL="https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest"
DOWNLOAD_BASE_URL="https://storage.googleapis.com/antigravity-public/antigravity-hub"

# Function to fetch and resolve latest release details for a platform
resolve_platform() {
local channel_arch="$1" # e.g., "x64" or "arm64"

local manifest_url="${MANIFEST_BASE_URL}/latest-${channel_arch}-linux.yml"
local yaml_data
if ! yaml_data=$(curl -s --fail "$manifest_url"); then
echo "Error: Failed to fetch manifest from $manifest_url" >&2
exit 1
fi

local ver
ver=$(echo "$yaml_data" | yq '. | .version')
local url
url=$(echo "$yaml_data" | yq '.files[] | select(.url == "https://*") | .url')
local exec_id
exec_id=$(echo "$url" | sed -E 's|.*/[0-9.]+-([0-9]+)/.*|\1|')

if [[ -z "$ver" || -z "$exec_id" ]]; then
echo "Error: Failed to parse version or execution ID from $manifest_url" >&2
exit 1
fi

echo "$ver" "$exec_id"
}

# Function to prefetch and calculate sha256 hash in SRI format
prefetch() {
local url="$1"

echo "Prefetching $url..." >&2
nix store prefetch-file --json "$url" | jq -r .hash
}

# Resolve latest versions and execution IDs for both platforms
echo "Checking latest releases..."
read -r x64_VERSION x64_EXEC_ID < <(resolve_platform "x64")
read -r arm64_VERSION arm64_EXEC_ID < <(resolve_platform "arm64")

# Enforce both platforms are on the same version
if [[ "$x64_VERSION" == "$arm64_VERSION" ]]; then
TARGET_VERSION="$x64_VERSION"
TARGET_EXEC_ID="$x64_EXEC_ID"
else
# Find the lower version to ensure both platforms support this release
TARGET_VERSION=$(echo -e "$x64_VERSION\n$arm64_VERSION" | sort -V | head -n 1)
if [[ "$TARGET_VERSION" == "$x64_VERSION" ]]; then
TARGET_EXEC_ID="$x64_EXEC_ID"
else
TARGET_EXEC_ID="$arm64_EXEC_ID"
fi
echo "Warning: Platform version mismatch detected (x64: $x64_VERSION, arm64: $arm64_VERSION)." >&2
echo "Enforcing same version across platforms by aligning to the lower version: $TARGET_VERSION" >&2
fi

# Construct target GCS URLs
x64_URL="${DOWNLOAD_BASE_URL}/${TARGET_VERSION}-${TARGET_EXEC_ID}/linux-x64/Antigravity.tar.gz"
arm64_URL="${DOWNLOAD_BASE_URL}/${TARGET_VERSION}-${TARGET_EXEC_ID}/linux-arm/Antigravity.tar.gz"

# Check if we actually need to update
if [[ -f "$SOURCE_JSON" ]]; then
CURRENT_VERSION=$(jq -r '.version // empty' "$SOURCE_JSON")
CURRENT_X64_URL=$(jq -r '.sources."x86_64-linux".url // empty' "$SOURCE_JSON")
CURRENT_ARM_URL=$(jq -r '.sources."aarch64-linux".url // empty' "$SOURCE_JSON")

if [[ "$CURRENT_X64_URL" == "$x64_URL" && "$CURRENT_ARM_URL" == "$arm64_URL" ]]; then
echo "Antigravity Hub is already up to date (version: $TARGET_VERSION)"
exit 0
fi

if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
echo "Version is the same ($TARGET_VERSION), but URLs have changed. Updating to fresh URLs..."
fi
fi

echo "Updating Antigravity Hub..."
echo " Target Version: $TARGET_VERSION"
echo " Target Exec ID: $TARGET_EXEC_ID"
echo " x64 URL: $x64_URL"
echo " arm64 URL: $arm64_URL"

# Write new sources.json
jq -n \
--arg ver "$TARGET_VERSION" \
--arg url_x64 "$x64_URL" \
--arg hash_x64 "$(prefetch "$x64_URL")" \
--arg root_x64 "Antigravity-x64" \
--arg url_arm "$arm64_URL" \
--arg hash_arm "$(prefetch "$arm64_URL")" \
--arg root_arm "Antigravity-arm64" \
'{
version: $ver,
sources: {
"x86_64-linux": { url: $url_x64, sha256: $hash_x64, sourceRoot: $root_x64 },
"aarch64-linux": { url: $url_arm, sha256: $hash_arm, sourceRoot: $root_arm }
}
}' > "$SOURCE_JSON"

echo "Successfully updated sources.json to $TARGET_VERSION."
Loading