Skip to content

Instantly share code, notes, and snippets.

@alchemizt33
Last active July 26, 2026 04:03
Show Gist options
  • Select an option

  • Save alchemizt33/884cd30f347900dd4e55ecdca85162a2 to your computer and use it in GitHub Desktop.

Select an option

Save alchemizt33/884cd30f347900dd4e55ecdca85162a2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -Eeuo pipefail
CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/provisioner/config.toml"
TEMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TEMP_DIR"' EXIT
read_config_bool() {
local section="$1"
local key="$2"
mise exec -- python - "$CONFIG_FILE" "$section" "$key" <<'PY'
import sys
import tomllib
from pathlib import Path
config_file = Path(sys.argv[1])
section = sys.argv[2]
key = sys.argv[3]
with config_file.open("rb") as file:
config = tomllib.load(file)
value = config.get(section, {}).get(key, False)
if not isinstance(value, bool):
print(
f"{section}.{key} must be true or false",
file=sys.stderr,
)
raise SystemExit(1)
print("true" if value else "false")
PY
}
mise exec -- bash -c '
op --version
gh --version
node --version
'
install_vscode() {
if command -v code >/dev/null 2>&1; then
echo "VS Code is already installed."
return
fi
echo "Downloading Visual Studio Code..."
curl -fL \
"https://update.code.visualstudio.com/latest/linux-deb-x64/stable" \
-o "$TEMP_DIR/vscode.deb"
echo "Installing Visual Studio Code..."
sudo apt-get update
sudo apt-get install -y "$TEMP_DIR/vscode.deb"
}
install_cursor() {
if command -v cursor >/dev/null 2>&1; then
echo "Cursor is already installed."
return
fi
echo "Downloading Cursor..."
curl -fL \
"https://api2.cursor.sh/updates/download/golden/linux-x64-deb/cursor/latest" \
-o "$TEMP_DIR/cursor.deb"
echo "Installing Cursor..."
sudo apt-get update
sudo apt-get install -y "$TEMP_DIR/cursor.deb"
}
if [[ "$(read_config_bool desktop vscode)" == "true" ]]; then
install_vscode
fi
if [[ "$(read_config_bool desktop cursor)" == "true" ]]; then
install_cursor
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment