Astro tracks me

Opting out of Astro's telemetry and third-party tooling toolbar is a little more tricky thanks to the new bespoke preferences system.

The ASTRO_TELEMETRY_DISABLED environment variable still works, but there is mention of doubling-down on the newer preferences system, and one is opted into telemetry by default so an equally forceful response is appropriate.

You’ll find two files in one of three places depending on your operating system. On macOS, the files live in ~/Library/Preferences/astro and on Linux they reside in ~/.config/astro. On Windows it’s in ~/AppData/Roaming.

Taking a look at the preferences directory on macOS we see two files.

$ ls -1 ~/Library/Preferences/astro
config.json
settings.json

The config.json file opts us into Telemetry with a persistent identifier, and the settings.json enables the bar with “custom apps and third-party tooling”.

I overwrite these files to prevent tracking and injecting of offers from third-parties with a little Nix.

{hostPlatform, ...}: let
  dir =
    if hostPlatform.isDarwin
    then "Library/Preferences/astro"
    else ".config/astro";
in {
  home = {
    sessionVariables = {
      ASTRO_TELEMETRY_DISABLED = "please";
    };

    file = {
      "${dir}/config.json".text = builtins.toJSON {
        telemetry = {
          enabled = false;
          anonymousId = "tracking-people-without-their-explicit-consent-is-real-unethical";
        };
      };

      "${dir}/settings.json".text = builtins.toJSON {
        devToolbar = {
          enabled = false;
        };
      };
    };
  };
}

hostPlatform is provided by lite-system, and comes from pkgs.stdenv.hostPlatform. With it, we can work around the special case in Astro’s preferences package, which one could argue should apply only to GUI apps on macOS and not command-line tools like Astro.

I’ve additionally blocked telemetry.astro.build with my firewall to ensure plausible churn doesn’t bypass my preferences again. One can only hope the FDQN used to track us doesn’t change anytime soon!