Better text in startup script

This commit is contained in:
2026-04-20 17:11:04 +02:00 Verified
parent 227833b29c
commit e348aca2a6
+14 -15
View File
@@ -31,12 +31,11 @@ resource "coder_agent" "main" {
startup_script = <<-EOT startup_script = <<-EOT
set -e set -e
# --- Logging Helper ---
log() { log() {
echo -e "\e[1;34m[INIT]\e[0m $(date +'%H:%M:%S') - $1" echo -e "\e[1;36m[ Init ]\e[0m $1"
} }
# 1. Prepare user home with default files # 1. Prepare user home with default files on first start.
if [ ! -f ~/.init_done ]; then if [ ! -f ~/.init_done ]; then
log "Fresh workspace detected. Starting first-time setup..." log "Fresh workspace detected. Starting first-time setup..."
@@ -44,7 +43,7 @@ resource "coder_agent" "main" {
cp -rT /etc/skel ~ cp -rT /etc/skel ~
# 2. Install GHCup & Haskell # 2. Install GHCup & Haskell
log "Installing GHCup, GHC, Cabal, and HLS (this will take a few minutes)..." log "Installing GHCup, GHC, Cabal, and HLS... (this may take a few minutes)"
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
BOOTSTRAP_HASKELL_INSTALL_GHCUP=1 \ BOOTSTRAP_HASKELL_INSTALL_GHCUP=1 \
@@ -54,11 +53,10 @@ resource "coder_agent" "main" {
sh sh
log "Haskell toolchain installed successfully." log "Haskell toolchain installed successfully."
# 3. Install Scala (Coursier) # 3. Install Scala via Coursier
log "Downloading Coursier for Scala management..." log "Installing Scala via Coursier (scala, scalac, sbt)..."
curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs
chmod +x cs chmod +x cs
log "Running Scala setup (Installing scala, scalac, sbt, etc.)..."
./cs setup --yes ./cs setup --yes
rm cs rm cs
log "Scala environment ready." log "Scala environment ready."
@@ -66,20 +64,21 @@ resource "coder_agent" "main" {
# 4. Python Venv # 4. Python Venv
log "Creating Python virtual environment in ~/.venv..." log "Creating Python virtual environment in ~/.venv..."
python3 -m venv ~/.venv python3 -m venv ~/.venv
log "Python venv created. Tip: Use 'source ~/.venv/bin/activate' to use it." log "Python venv created."
# 5. Finalize # 5. Finalize
touch ~/.init_done touch ~/.init_done
log "Setup complete! All tools are installed in your persistent home volume." log "First-time setup complete!"
else else
log "Persistent volume detected. Tools are already installed in /home/${local.username}." log "Persistent volume detected. Tools are already available."
fi fi
# This runs every time, even if setup is already done # Ensure PATH is updated for the session.
log "Ensuring PATH is updated for current session..." if [ -f "$HOME/.ghcup/env" ]; then
# Add GHCup and local bins to path if not already there source "$HOME/.ghcup/env"
[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" fi
log "Workspace is ready for coding."
log "Workspace is ready."
EOT EOT
# These environment variables allow you to make Git commits right away after creating a # These environment variables allow you to make Git commits right away after creating a