#!/usr/bin/env nu # SPDX-License-Identifier: AGPL-3.0-only # Copyright (c) 2026 MatrixFurry use std/log let axr_containers = try { distrobox ls | parse "{id} | {name} | {status} | {image}" | skip 1 | get name | str trim | where $it == envision or $it == atomic-xr } catch {[]} def main []: nothing -> nothing { log info "Starting migration" # TODO: Add explanation of the changes # Get current state let migrate_envision = ($axr_containers | length) != 0 mut cli_installed = (which axr | length) != 0 # Remove AtomicXR Envision if $migrate_envision and not $cli_installed { log info "Temporarily installing the AtomicXR CLI to remove AtomicXR Envision" try { brew install atomicxr-cli $cli_installed = true } catch { log critical "The AtomicXR CLI is required to remove AtomicXR Envision" return 1 } } if $migrate_envision { log info "Removing AtomicXR Envision" axr envision uninstall } else { log info "AtomicXR Envision is not installed, skipping this step" } # Remove AtomicXR CLI, and revert it's changes if $cli_installed { log info "Removing AtomicXR CLI" remove-atomicxr-cli } else { log info "AtomicXR CLI is not installed, skipping this step" } # Migrate to Homebrew-XR tap migrate-tap # Install Envision if needed if $migrate_envision { brew install envision } log info "Migration finished" } def remove-atomicxr-cli []: nothing -> nothing { log info "Removing runtime system packages" axr runtime uninstall log info "Reverting manual AtomicXR CLI configuration" axr flatpak steam disable-xr axr flatpak gaiasky disable-vr log info "Uninstalling AtomicXR CLI" brew remove atomicxr-cli } def migrate-tap []: nothing -> nothing { let axr_taps = brew tap | lines | where $it like "matrixfurry.*/atomic.*" if ($axr_taps | length) == 0 { log warning "Could not find installed AtomicXR Homebrew Tap, skipping this step" return } log info "Removing packages installed via the AtomicXR Homebrew Tap" brew list --full-name | lines | where $it like "matrixfurry.*/atomic.*/" | each {|pkg| log info $"-> Uninstalling package: ($pkg | str replace --regex '.*/' '')" brew remove $pkg } log info "Removing the AtomicXR Homebrew Tap" $axr_taps | each {|tap| brew untap $tap } log info "Adding Homebrew-XR tap" brew tap matrixfurry.com/xr https://tangled.org/matrixfurry.com/homebrew-xr # TODO: Re-install packages from new tap }