minimumLimaVersion: 2.0.0 base: - template:_images/ubuntu-lts vmType: qemu cpus: 2 memory: 4GiB disk: 40GiB mountType: 9p mounts: - location: /dat/datcode/data writable: true containerd: system: false user: false param: DatcodeRoot: /dat/datcode provision: - mode: system script: | # shell #!/bin/bash set -euo pipefail hostnamectl set-hostname datcode export DEBIAN_FRONTEND=noninteractive if ! command -v curl >/dev/null 2>&1 \ || ! command -v unzip >/dev/null 2>&1 \ || ! command -v git >/dev/null 2>&1 \ || ! command -v jq >/dev/null 2>&1 \ || ! command -v tmux >/dev/null 2>&1; then apt-get update apt-get install -y ca-certificates curl git jq tmux unzip fi if ! command -v docker >/dev/null 2>&1; then curl -fsSL https://get.docker.com | sh fi systemctl enable --now docker usermod -aG docker "{{.User}}" - mode: user script: | # shell #!/bin/bash set -euo pipefail export BUN_INSTALL="$HOME/.local" datcode_root="{{.Param.DatcodeRoot}}" link_directory() { target=$1 link=$2 mkdir -p "$target" "$(dirname "$link")" if [ -d "$link" ] && [ ! -L "$link" ]; then rmdir "$link" elif [ -e "$link" ] && [ ! -L "$link" ]; then printf '%s\n' "datcode: refusing to replace existing path $link" >&2 exit 1 fi ln -sfn "$target" "$link" } link_directory "$datcode_root/data/config" "$HOME/.config/opencode" link_directory "$datcode_root/data/share" "$HOME/.local/share/opencode" link_directory "$datcode_root/data/state" "$HOME/.local/state/opencode" link_directory "$datcode_root/data/tmux" "$HOME/.config/tmux" if [ ! -x "$HOME/.tmux/plugins/tpm/tpm" ]; then git clone --depth 1 https://github.com/tmux-plugins/tpm \ "$HOME/.tmux/plugins/tpm" fi if [ ! -d "$HOME/.tmux/plugins/tmux" ]; then "$HOME/.tmux/plugins/tpm/bin/install_plugins" fi if [ ! -x "$BUN_INSTALL/bin/bun" ]; then curl -fsSL https://bun.sh/install | bash fi if [ ! -x "$BUN_INSTALL/bin/opencode" ]; then "$BUN_INSTALL/bin/bun" install --global opencode-ai fi sudo ln -sfn "$BUN_INSTALL/bin/bun" /usr/local/bin/bun sudo ln -sfn "$BUN_INSTALL/bin/opencode" /usr/local/bin/opencode