Repository navigation
Expand file tree
/
Copy pathuser-data.example.tpl
More file actions
149 lines (127 loc) · 6.69 KB
/
Copy pathuser-data.example.tpl
File metadata and controls
149 lines (127 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#cloud-config
# =============================================================================
# user-data.example.tpl — Example cloud-init provisioning for a Claude Code VM
#
# Copy this to user-data.tpl and customise. The following tokens are
# substituted at launch time by launch-vm.sh from your .conf file:
#
# __VM_USER__ Linux username
# __VM_PASSWORD__ Login password (plain-text, hashed by cloud-init)
# __VM_HOSTNAME__ Hostname
# __SHARED_MOUNTS__ Generated from SHARED_FOLDER_N / SHARED_MOUNT_N pairs
# __SHARED_MKDIR__ Generated list of guest-side mount paths
#
# Run after editing:
# ./launch-vm.sh --reset [your.conf]
# =============================================================================
# ── User ──────────────────────────────────────────────────────────────────────
users:
- name: __VM_USER__
gecos: VM User
groups: [adm, sudo, cdrom, audio, video, plugdev, netdev, lpadmin]
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
# ── SSH authorized keys ─────────────────────────────────────────────────
# Paste your public key here. MUST be inside this user block —
# top-level ssh_authorized_keys is silently ignored for non-default users.
ssh_authorized_keys:
- ssh-ed25519 AAAA... you@yourhost
chpasswd:
expire: false
users:
- name: __VM_USER__
password: __VM_PASSWORD__
type: text
# ── Hostname ──────────────────────────────────────────────────────────────────
hostname: __VM_HOSTNAME__
manage_etc_hosts: true
# ── Locale & timezone ─────────────────────────────────────────────────────────
timezone: Europe/Amsterdam
locale: en_US.UTF-8
# ── Static files ──────────────────────────────────────────────────────────────
write_files:
# GDM3 autologin — Wayland disabled for SPICE clipboard compatibility
- path: /etc/gdm3/custom.conf
owner: root:root
permissions: '0644'
content: |
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=__VM_USER__
WaylandEnable=false
[security]
[xdmcp]
[chooser]
[debug]
# virtio-9p modules for shared folders
- path: /etc/modules-load.d/virtio-9p.conf
owner: root:root
permissions: '0644'
content: |
9p
9pnet_virtio
# ── Environment variables ──────────────────────────────────────────────────
# /etc/environment is read by PAM for every session, including the GUI.
# Syntax: KEY="value" only — no export, no shell logic, no variable expansion.
- path: /etc/environment
content: |
EDITOR="vim"
RUST_LOG="debug"
MY_API_KEY="changeme"
# ── Shell environment (login shells only: SSH, login terminals) ────────────
# Use this for PATH extensions or anything needing shell syntax.
- path: /etc/profile.d/vm-env.sh
permissions: '0644'
content: |
export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
# ── Git config ────────────────────────────────────────────────────────────
- path: /etc/gitconfig
content: |
[user]
name = Your Name
email = you@example.com
[core]
editor = vim
[init]
defaultBranch = main
# ── Shared folder mounts ──────────────────────────────────────────────────────
# Do not edit — generated by launch-vm.sh from SHARED_FOLDER_N / SHARED_MOUNT_N.
mounts:
__SHARED_MOUNTS__
# ── Early boot ────────────────────────────────────────────────────────────────
bootcmd:
- modprobe 9p || true
- modprobe 9pnet_virtio || true
- mkdir -p__SHARED_MKDIR__
# ── Provisioning commands ──────────────────────────────────────────────────────
runcmd:
# Fix home directory ownership
- chown -R __VM_USER__:__VM_USER__ /home/__VM_USER__ || true
# SPICE clipboard
- systemctl enable --now spice-vdagentd || true
# Suppress the 2-minute network timeout under QEMU user-mode networking
- systemctl disable systemd-networkd-wait-online.service || true
- systemctl mask systemd-networkd-wait-online.service || true
# ── System packages ────────────────────────────────────────────────────────
- apt-get update -y
- apt-get install -y
vim
curl
wget
git
build-essential
python3-pip
python3-venv
jq
# ── Rust ──────────────────────────────────────────────────────────────────
# Install rustup for the VM user (non-interactive, stable toolchain)
# - su - __VM_USER__ -c "curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path"
# ── Node.js (via NodeSource) ───────────────────────────────────────────────
# - curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
# - apt-get install -y nodejs
# ── Python packages ───────────────────────────────────────────────────────
# - pip3 install --break-system-packages httpie black ruff
# ── Claude Code ───────────────────────────────────────────────────────────
# Requires Node.js — uncomment the Node.js block above first.
# - npm install -g @anthropic-ai/claude-code