# AthenaOS macOS VM profile for Lima.
# Public install:
#   curl -fsSL https://apt.athena-os.org/install-macos.sh | bash
#
# Manual start:
#   curl -fsSL https://apt.athena-os.org/macos/athenaos-lima.yaml -o athenaos-lima.yaml
#   limactl start --name athenaos athenaos-lima.yaml
#   limactl shell athenaos

images:
  - location: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2"
    arch: "x86_64"
  - location: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-arm64.qcow2"
    arch: "aarch64"

cpus: 4
memory: "6GiB"
disk: "40GiB"

mounts:
  - location: "~"
    writable: true

containerd:
  system: false
  user: false

provision:
  - mode: system
    script: |
      #!/usr/bin/env bash
      set -euxo pipefail
      export DEBIAN_FRONTEND=noninteractive

      apt-get update
      apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        docker-compose-v2 \
        docker.io \
        git \
        jq \
        nodejs \
        npm \
        python3 \
        ripgrep \
        sudo

      install -d -m 0755 /usr/share/keyrings
      curl -fsSL https://apt.athena-os.org/athenaos-archive-keyring.asc \
        >/usr/share/keyrings/athenaos-archive-keyring.asc
      cat >/etc/apt/sources.list.d/athenaos.list <<'EOF'
      deb [signed-by=/usr/share/keyrings/athenaos-archive-keyring.asc] https://apt.athena-os.org stable main
      EOF
      apt-get update
      apt-get install -y --no-install-recommends athenaos-cli

      mkdir -p /opt/athena /workspace/projects /workspace/agents /workspace/sandbox /workspace/archives
      chown -R ${LIMA_CIDATA_USER}:${LIMA_CIDATA_USER} /workspace
      usermod -aG docker "${LIMA_CIDATA_USER}"

      cp /etc/os-release /etc/os-release.base
      cat >/etc/os-release <<'EOF'
      NAME="AthenaOS"
      VERSION="0.3.3 Lima Edition"
      ID=athenaos
      ID_LIKE="debian"
      VERSION_ID="0.3.3"
      VERSION_CODENAME=elysium
      PRETTY_NAME="AthenaOS 0.3.3 Lima Edition"
      HOME_URL="https://athena-os.org"
      SUPPORT_URL="https://athena-os.org/install/"
      BUG_REPORT_URL="https://athena-os.org"
      EOF

      cat >/etc/motd <<'EOF'
      Welcome to AthenaOS

      By AI. For AI.

      AI-native Linux development environment optimized for:
      - AI-assisted coding
      - Dockerized applications
      - backend engineering
      - autonomous agents
      - infrastructure automation

      Workspace:
        /workspace/projects

      Athena CLI:
        athena doctor
        athena new fastapi
        athena new nextjs

      Happy shipping.
      EOF

      cat >/etc/profile.d/athenaos.sh <<'EOF'
      export ATHENA_WORKSPACE="${ATHENA_WORKSPACE:-/workspace/projects}"
      alias ath='athena'
      alias projects='cd /workspace/projects'
      EOF

probes:
  - script: |
      #!/usr/bin/env bash
      set -euxo pipefail
      command -v python3
      command -v docker
    hint: "AthenaOS base tools are still installing."

message: |
  AthenaOS Lima VM is running.

  Open it with:
    limactl shell athenaos
    athena version
    athena self-test
