diff --git a/customize.sh b/customize.sh index 35593a6..f9f034b 100755 --- a/customize.sh +++ b/customize.sh @@ -392,6 +392,7 @@ apt-get update DEBIAN_FRONTEND=noninteractive apt-get -y upgrade DEBIAN_FRONTEND=noninteractive apt-get -y install ${APT_PACKAGES_ESCAPED} curl -fsSL https://mise.run | MISE_INSTALL_PATH=\"$MISE_INSTALL_PATH\" MISE_VERSION=\"$MISE_VERSION\" sh +\"$MISE_INSTALL_PATH\" use -g github:anomalyco/opencode mkdir -p /etc/profile.d cat > /etc/profile.d/mise.sh <<'MISEPROFILE' if [ -n \"\${BASH_VERSION:-}\" ] && [ -x \"$MISE_INSTALL_PATH\" ]; then diff --git a/internal/daemon/imagebuild.go b/internal/daemon/imagebuild.go index 2186cc3..51aec52 100644 --- a/internal/daemon/imagebuild.go +++ b/internal/daemon/imagebuild.go @@ -23,6 +23,7 @@ const ( defaultMiseVersion = "v2025.12.0" defaultMiseInstallPath = "/usr/local/bin/mise" defaultMiseActivateLine = `eval "$(/usr/local/bin/mise activate bash)"` + defaultOpenCodeTool = "github:anomalyco/opencode" ) type imageBuildSpec struct { @@ -258,6 +259,7 @@ func buildModulesCommand(modulesBase string) string { func appendMiseSetup(script *bytes.Buffer) { fmt.Fprintf(script, "curl -fsSL https://mise.run | MISE_INSTALL_PATH=%s MISE_VERSION=%s sh\n", shellQuote(defaultMiseInstallPath), shellQuote(defaultMiseVersion)) + fmt.Fprintf(script, "%s use -g %s\n", shellQuote(defaultMiseInstallPath), shellQuote(defaultOpenCodeTool)) script.WriteString("mkdir -p /etc/profile.d\n") script.WriteString("cat > /etc/profile.d/mise.sh <<'EOF'\n") fmt.Fprintf(script, "if [ -n \"${BASH_VERSION:-}\" ] && [ -x %s ]; then\n", shellQuote(defaultMiseInstallPath)) diff --git a/internal/daemon/imagebuild_test.go b/internal/daemon/imagebuild_test.go index 86b2733..56d404b 100644 --- a/internal/daemon/imagebuild_test.go +++ b/internal/daemon/imagebuild_test.go @@ -11,6 +11,7 @@ func TestBuildProvisionScriptInstallsAndActivatesMise(t *testing.T) { script := buildProvisionScript("devbox", "1.1.1.1", []string{"git", "curl"}, false) for _, snippet := range []string{ "curl -fsSL https://mise.run | MISE_INSTALL_PATH='/usr/local/bin/mise' MISE_VERSION='v2025.12.0' sh", + "'/usr/local/bin/mise' use -g 'github:anomalyco/opencode'", "cat > /etc/profile.d/mise.sh <<'EOF'", "if [ -n \"${BASH_VERSION:-}\" ] && [ -x '/usr/local/bin/mise' ]; then", `eval "$(/usr/local/bin/mise activate bash)"`,