From e348aca2a62bfb31c854aca6412d974c717f3e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20S=C3=B6derberg?= Date: Mon, 20 Apr 2026 17:11:04 +0200 Subject: [PATCH] Better text in startup script --- main.tf | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/main.tf b/main.tf index 229e94f..c1a378e 100644 --- a/main.tf +++ b/main.tf @@ -31,12 +31,11 @@ resource "coder_agent" "main" { startup_script = <<-EOT set -e - # --- Logging Helper --- 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 log "Fresh workspace detected. Starting first-time setup..." @@ -44,7 +43,7 @@ resource "coder_agent" "main" { cp -rT /etc/skel ~ # 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 | \ BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ BOOTSTRAP_HASKELL_INSTALL_GHCUP=1 \ @@ -54,11 +53,10 @@ resource "coder_agent" "main" { sh log "Haskell toolchain installed successfully." - # 3. Install Scala (Coursier) - log "Downloading Coursier for Scala management..." + # 3. Install Scala via Coursier + 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 chmod +x cs - log "Running Scala setup (Installing scala, scalac, sbt, etc.)..." ./cs setup --yes rm cs log "Scala environment ready." @@ -66,20 +64,21 @@ resource "coder_agent" "main" { # 4. Python Venv log "Creating Python virtual environment in ~/.venv..." python3 -m venv ~/.venv - log "Python venv created. Tip: Use 'source ~/.venv/bin/activate' to use it." + log "Python venv created." # 5. Finalize touch ~/.init_done - log "Setup complete! All tools are installed in your persistent home volume." + log "First-time setup complete!" else - log "Persistent volume detected. Tools are already installed in /home/${local.username}." + log "Persistent volume detected. Tools are already available." fi - # This runs every time, even if setup is already done - log "Ensuring PATH is updated for current session..." - # Add GHCup and local bins to path if not already there - [ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" - log "Workspace is ready for coding." + # Ensure PATH is updated for the session. + if [ -f "$HOME/.ghcup/env" ]; then + source "$HOME/.ghcup/env" + fi + + log "Workspace is ready." EOT # These environment variables allow you to make Git commits right away after creating a