Skip to content

devbox integrate does NOT run init_hook #2703

@tm-michael

Description

@tm-michael

What happened?

When the VSCode extension is run and on selects "Reopen devbox", it only sets the env variables but it doesn't run the init hook. Init hooks can include important steps and set other environment variables that aren't set using the env key in the devbox.json. When using things like Cursor or extensions that open their own shells and don't get the devbox shell injection, they thus lack important variables

Steps to reproduce

  1. create a devbox.json with an init_hook that sets an environment variable e.g TEST=true
  2. open the project in VSCode with the extension installed and the "devbox shell" injection deactivated Image
  3. use the "reopen in devbox" feature
  4. open a terminal and run echo $TEST

It will not be set.

Command

No response

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.16.0/.schema/devbox.schema.json",
  "packages": [],
  "env": {
    "SOMETHING": "hello"
  },
  "shell": {
    "init_hook": [
      "export TEST=true"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.16.0

Nix version

2.31.0

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions