antigravity-cli: Update to 1.0.3 and adding additonal maintainer (#524900)
This commit is contained in:
@@ -710,6 +710,12 @@
|
||||
githubId = 25004152;
|
||||
name = "Adrian Gunnar Lauterer";
|
||||
};
|
||||
adrielvelazquez = {
|
||||
email = "AdrielVelazquez@gmail.com";
|
||||
github = "AdrielVelazquez";
|
||||
githubId = 3443378;
|
||||
name = "Adriel Velazquez";
|
||||
};
|
||||
AdrienLemaire = {
|
||||
email = "lemaire.adrien@gmail.com";
|
||||
github = "AdrienLemaire";
|
||||
|
||||
@@ -8,27 +8,34 @@
|
||||
|
||||
let
|
||||
# Version and platform-specific data retrieved from Google's manifests
|
||||
version = "1.0.2";
|
||||
version = "1.0.3";
|
||||
|
||||
sources = {
|
||||
sourceData = {
|
||||
"x86_64-linux" = {
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.2-6109799369277440/linux-x64/cli_linux_x64.tar.gz";
|
||||
hash = "sha256-XAq2oHWaAe2AoAgDBb1/NvABfkodg3xYTDmTY5H9RD0=";
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.3-6459114696605696/linux-x64/cli_linux_x64.tar.gz";
|
||||
hash = "sha256-UM/b3TuXROHHx0dKMU0KtENNREmY+VAYKmxRWewu/ic=";
|
||||
};
|
||||
"aarch64-linux" = {
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.2-6109799369277440/linux-arm/cli_linux_arm64.tar.gz";
|
||||
hash = "sha256-7pj7TMHg+Z7DyWVmXOMqoM9kQkw5FxXTF+P4hGYc2hE=";
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.3-6459114696605696/linux-arm/cli_linux_arm64.tar.gz";
|
||||
hash = "sha256-Cp44KTj1wP85y6Z6oCOd1ylL2nTg1mDx7aJuv/Q7nBE=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.2-6109799369277440/darwin-arm/cli_mac_arm64.tar.gz";
|
||||
hash = "sha256-stu8KZDa5id5wVImTgyedkIKJPdkBTagRCphoYLWUoI=";
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.3-6459114696605696/darwin-arm/cli_mac_arm64.tar.gz";
|
||||
hash = "sha256-lbf6dCJ7QhDNomfpi10Dhk9VShxAxTC0zsFIFpGlbtA=";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.2-6109799369277440/darwin-x64/cli_mac_x64.tar.gz";
|
||||
hash = "sha256-KDOEEgFhvpO9bifljSuhRKpb+J6c+q4TWmnrNAAS3A0=";
|
||||
url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.0.3-6459114696605696/darwin-x64/cli_mac_x64.tar.gz";
|
||||
hash = "sha256-B1zPkt4h3JN7ZWhin0iTQMCe+NhVvBGKWCLfKnBrZnw=";
|
||||
};
|
||||
};
|
||||
|
||||
sources = lib.mapAttrs (
|
||||
_system: source:
|
||||
fetchzip {
|
||||
inherit (source) url hash;
|
||||
}
|
||||
) sourceData;
|
||||
|
||||
source =
|
||||
sources.${stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
@@ -37,9 +44,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "antigravity-cli";
|
||||
inherit version;
|
||||
|
||||
src = fetchzip {
|
||||
inherit (source) url hash;
|
||||
};
|
||||
src = source;
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
@@ -61,15 +66,27 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.py;
|
||||
inherit sources;
|
||||
updateScript = [
|
||||
./update.sh
|
||||
version
|
||||
]
|
||||
++ lib.concatMap (system: [
|
||||
system
|
||||
sourceData.${system}.url
|
||||
]) (lib.attrNames sourceData);
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Google's Go-based terminal user interface (TUI) agent client";
|
||||
homepage = "https://antigravity.google";
|
||||
changelog = "https://antigravity.google/changelog";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = with lib.maintainers; [ u3kkasha ];
|
||||
platforms = lib.attrNames sources;
|
||||
maintainers = with lib.maintainers; [
|
||||
adrielvelazquez
|
||||
u3kkasha
|
||||
];
|
||||
platforms = lib.attrNames sourceData;
|
||||
mainProgram = "agy";
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p python3 nix jq
|
||||
|
||||
import re
|
||||
import urllib.request
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
MANIFEST_BASE = (
|
||||
"https://antigravity-cli-auto-updater-974169037036.us-central1.run.app/manifests"
|
||||
)
|
||||
PLATFORMS = {
|
||||
"x86_64-linux": "linux_amd64",
|
||||
"aarch64-linux": "linux_arm64",
|
||||
"x86_64-darwin": "darwin_amd64",
|
||||
"aarch64-darwin": "darwin_arm64",
|
||||
}
|
||||
|
||||
|
||||
def fetch_json(url):
|
||||
req = urllib.request.Request(
|
||||
url, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
|
||||
)
|
||||
with urllib.request.urlopen(req) as response:
|
||||
return json.loads(response.read().decode("utf-8"))
|
||||
|
||||
|
||||
def get_nix_hash(url):
|
||||
"""Downloads, unpacks, and returns the SRI hash of the directory content."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
archive_path = os.path.join(tmpdir, "archive.tar.gz")
|
||||
unpack_path = os.path.join(tmpdir, "unpack")
|
||||
os.makedirs(unpack_path)
|
||||
|
||||
# Download
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
with (
|
||||
urllib.request.urlopen(req) as response,
|
||||
open(archive_path, "wb") as out_file,
|
||||
):
|
||||
out_file.write(response.read())
|
||||
|
||||
# Unpack
|
||||
subprocess.run(["tar", "-xzf", archive_path, "-C", unpack_path], check=True)
|
||||
|
||||
# Hash
|
||||
result = subprocess.run(
|
||||
["nix", "hash", "path", "--type", "sha256", unpack_path],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True,
|
||||
)
|
||||
return result.stdout.strip()
|
||||
|
||||
|
||||
def main():
|
||||
# Change directory to the script's directory so paths are relative
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(script_dir)
|
||||
|
||||
print("Checking for updates from Google Antigravity release API...")
|
||||
|
||||
# 1. Fetch the latest version from the linux_amd64 manifest
|
||||
try:
|
||||
manifest = fetch_json(f"{MANIFEST_BASE}/linux_amd64.json")
|
||||
except Exception as e:
|
||||
print(f"Error fetching manifest: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
latest_version = manifest["version"]
|
||||
|
||||
# Read the current package.nix
|
||||
package_file = "package.nix"
|
||||
if not os.path.exists(package_file):
|
||||
print(f"Error: Could not find package.nix in {script_dir}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
with open(package_file, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# Extract current version
|
||||
version_match = re.search(r'version\s*=\s*"([^"]*)"', content)
|
||||
if not version_match:
|
||||
print(
|
||||
"Error: Could not parse current version from package.nix", file=sys.stderr
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
current_version = version_match.group(1)
|
||||
|
||||
if current_version == latest_version:
|
||||
print(f"Already up to date (current version {current_version} is the latest).")
|
||||
sys.exit(0)
|
||||
|
||||
print(f"New version found! Updating: {current_version} -> {latest_version}")
|
||||
|
||||
# 2. Update the version string in content
|
||||
content = re.sub(
|
||||
r'(version\s*=\s*")[^"]*(";)', f"\\g<1>{latest_version}\\g<2>", content
|
||||
)
|
||||
|
||||
# 3. For each platform, fetch url and hash, and update sources
|
||||
for platform, manifest_name in PLATFORMS.items():
|
||||
print(f"Fetching manifest for {platform}...")
|
||||
try:
|
||||
m = fetch_json(f"{MANIFEST_BASE}/{manifest_name}.json")
|
||||
except Exception as e:
|
||||
print(f"Error fetching manifest for {platform}: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
url = m["url"]
|
||||
sri_hash = get_nix_hash(url)
|
||||
|
||||
# Regex to locate and replace URL and hash for this specific platform in package.nix
|
||||
pattern = rf'("{platform}"\s*=\s*\{{[^}}]+url\s*=\s*")[^"]*(";[^}}]+hash\s*=\s*")[^"]*(";)'
|
||||
replacement = f"\\g<1>{url}\\g<2>{sri_hash}\\g<3>"
|
||||
|
||||
content = re.sub(pattern, replacement, content)
|
||||
|
||||
# Write the updated content back
|
||||
with open(package_file, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"Successfully updated package.nix to version {latest_version}!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash common-updater-scripts coreutils curl gnutar nix
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
nixpkgs_root="$(realpath "$script_dir/../../../..")"
|
||||
package_file="$script_dir/package.nix"
|
||||
tmpdir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
cd -- "$nixpkgs_root"
|
||||
|
||||
if (( $# < 3 || ($# - 1) % 2 != 0 )); then
|
||||
echo "Usage: $0 <version> [<system> <url>]..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="$1"
|
||||
shift
|
||||
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
|
||||
hash_url() {
|
||||
local system="$1"
|
||||
local url="$2"
|
||||
local archive="$tmpdir/$system.tar.gz"
|
||||
local unpack_dir="$tmpdir/$system-unpack"
|
||||
|
||||
mkdir -p "$unpack_dir"
|
||||
curl -fsSL "$url" -o "$archive" || return
|
||||
tar -xzf "$archive" -C "$unpack_dir" || return
|
||||
|
||||
if [[ ! -x "$unpack_dir/antigravity" ]]; then
|
||||
echo "Expected executable 'antigravity' in $url" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
nix hash path --type sha256 "$unpack_dir"
|
||||
}
|
||||
|
||||
while (( $# > 0 )); do
|
||||
system="$1"
|
||||
url="$2"
|
||||
shift 2
|
||||
|
||||
if [[ "$url" != *"/antigravity-cli/$version-"* ]]; then
|
||||
echo "URL for $system does not match package version $version: $url" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Hashing $system from $url"
|
||||
hash="$(hash_url "$system" "$url")"
|
||||
update-source-version antigravity-cli "$version" "$hash" \
|
||||
--file="$package_file" \
|
||||
--ignore-same-hash \
|
||||
--ignore-same-version \
|
||||
--source-key="sources.$system" \
|
||||
--system="$system"
|
||||
done
|
||||
Reference in New Issue
Block a user