dotfiles
- 28 commits
- 1 branch
- 0 tags
- updated
- CI 1/1
init-vm.sh
1.7 KB · 55 lines
1#!/bin/bash2# Set up a new OrbStack VM.3# Run this on your Mac:4# ./init-vm.sh MACHINE_NAME5# Afterwards, ssh in and paste your bashrc at the end of ~/.bashrc67set -e # stop if any step fails89NAME="$1"10if [ -z "$NAME" ]; then11 echo "Usage: ./init-vm.sh MACHINE_NAME"12 exit 113fi1415# Folders in ~/.config on your Mac to copy into the VM. Edit as needed.16CONFIGS="fzf helix bat"171819echo "== 0. Create isolated VM with mounted project folder =="20orb create --isolated --forward-ssh-agent \21 --mount /Users/daniel/projects:/home/daniel/projects \22 ubuntu:resolute "$NAME" --isolate-network2324# The mount creates /home/daniel as root, so give it back to you25orb -m "$NAME" sudo chown daniel:daniel /home/daniel2627# Because of that, Ubuntu skipped the default shell files. Copy them in.28orb -m "$NAME" cp /etc/skel/.bashrc /etc/skel/.profile /etc/skel/.bash_logout /home/daniel/293031echo "== 1. Install standard packages =="32orb -m "$NAME" sudo apt update33orb -m "$NAME" sudo apt modernize-sources34orb -m "$NAME" sudo apt install -y nano vim-tiny less ca-certificates curl gnupg wget xz-utils unzip git build-essential passt bubblewrap35orb -m "$NAME" sudo apt update363738echo "== 2. Install mise =="39orb -m "$NAME" bash -c 'curl https://mise.run | sh'404142echo "== 3. Install global tools with mise =="43orb -m "$NAME" bash -c '~/.local/bin/mise use -g bat delta difftastic eza fd fzf helix jj jq node pi ripgrep zoxide'444546echo "== 4. Copy ~/.config folders from your Mac =="47orb -m "$NAME" mkdir -p /home/daniel/.config48for folder in $CONFIGS; do49 echo " copying $folder"50 orb push -m "$NAME" ~/.config/$folder /home/daniel/.config/51done525354echo "Done. Now run: ssh $NAME@orb"55echo "Then paste your bashrc at the end of ~/.bashrc"