|
| 1 | +# Antigravity CLI component (ECS: profile). Google's terminal agent, `agy`. |
| 2 | +# |
| 3 | +# This is how a second model is reached from here. Not the browser: signing in to Gemini through |
| 4 | +# an automated browser does not work, and was tried — Google returns the sign-in flow to its first |
| 5 | +# step for anything driven over CDP, whatever the password is. And not gemini-cli, which was also |
| 6 | +# tried and is over: it answers "this client is no longer supported" after authenticating, at any |
| 7 | +# version, and nixpkgs marks it for removal for the same reason. Auth is the account's own OAuth |
| 8 | +# (one interactive `agy` per machine), which is what the AI Pro subscription applies to. |
| 9 | +# |
| 10 | +# The rolling agents lineage on purpose: Google refuses old clients outright, so pinning this |
| 11 | +# particular tool would only decide in advance the day it stops working. |
| 12 | +{ |
| 13 | + config, |
| 14 | + lib, |
| 15 | + pkgs, |
| 16 | + nixpkgsAgents, |
| 17 | + ... |
| 18 | +}: |
| 19 | +let |
| 20 | + agentPkgs = import ../../lib/unstable-pkgs.nix { |
| 21 | + nixpkgsUnstable = nixpkgsAgents; |
| 22 | + inherit (pkgs.stdenv.hostPlatform) system; |
| 23 | + }; |
| 24 | + |
| 25 | + # Declared keys only. Pro rather than Flash by default because this is the tool reached for a |
| 26 | + # second opinion, where the answer matters more than what it costs; `--model` picks another per |
| 27 | + # call (`agy models` lists them, Claude and gpt-oss included). |
| 28 | + settings = { |
| 29 | + model = "gemini-3.1-pro-high"; |
| 30 | + enableTelemetry = false; |
| 31 | + }; |
| 32 | + |
| 33 | + wanted = pkgs.writeText "agy-settings.json" (builtins.toJSON settings); |
| 34 | + settingsFile = "${config.home.homeDirectory}/.gemini/antigravity-cli/settings.json"; |
| 35 | +in |
| 36 | +{ |
| 37 | + home.packages = [ agentPkgs.antigravity-cli ]; |
| 38 | + |
| 39 | + # Merged rather than linked: agy owns this file and writes to it as it runs (every directory |
| 40 | + # trusted lands here). A read-only store symlink would be a file it cannot update, so the keys |
| 41 | + # declared above are merged into whatever it already has, and everything else is left alone. |
| 42 | + home.activation.agySettings = lib.hm.dag.entryAfter [ "writeBoundary" ] '' |
| 43 | + $DRY_RUN_CMD ${pkgs.python3}/bin/python3 - <<'PY' |
| 44 | + import json, pathlib |
| 45 | +
|
| 46 | + target = pathlib.Path("${settingsFile}") |
| 47 | + target.parent.mkdir(parents=True, exist_ok=True) |
| 48 | + try: |
| 49 | + current = json.loads(target.read_text()) |
| 50 | + except (FileNotFoundError, json.JSONDecodeError): |
| 51 | + current = {} |
| 52 | + merged = {**current, **json.loads(pathlib.Path("${wanted}").read_text())} |
| 53 | + if merged != current: |
| 54 | + target.write_text(json.dumps(merged, indent=2) + "\n") |
| 55 | + PY |
| 56 | + ''; |
| 57 | +} |
0 commit comments