jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.83k stars 187 forks source link

`refresh` alias overwrites init_hook #2103

Open glennpratt opened 1 month ago

glennpratt commented 1 month ago

What happened?

➜  devbox shell
Starting a devbox shell...
You can activate the virtual environment by running '. $VENV_DIR/bin/activate' (for fish shell, replace '.' with 'source')
➜  which python
/Users/gpratt/Code/my-project/bin/python
➜  refresh
➜  which python
/Users/gpratt/Code/my-project/.devbox/nix/profile/default/bin/python

I suppose I can just not use it, but other users will be prompted to use it, then things break for reasons they may not realize.

Steps to reproduce

  1. Create an init_hook which updates PATH
  2. Call refresh
  3. See PATH changes from init_hook are lost.

Command

shell

devbox.json

{
  "packages": {
    "age":             "latest",
    "argocd":          "2.8",
    "autossh":         "latest",
    "cilium-cli":      "latest",
    "coreutils":       "latest",
    "curl":            "latest",
    "git":             "latest",
    "gnumake":         "latest",
    "jq":              "latest",
    "kubectl":         "1.28",
    "kubernetes-helm": "latest",
    "linode-cli":      "latest",
    "mkcert":          "latest",
    "netcat-openbsd": {
      "version":            "latest",
      "excluded_platforms": ["aarch64-darwin", "x86_64-darwin"]
    },
    "pulumi":                                "latest",
    "pulumiPackages.pulumi-language-python": "latest",
    "python":                                "3.11",
    "s3cmd":                                 "latest",
    "shellcheck":                            "latest",
    "sonobuoy":                              "latest",
    "stdenv.cc.cc.lib":                      "",
    "tilt":                                  "latest",
    "uv":                                    "latest",
    "yq-go":                                 "latest",
    "ruff":                                  "0.4.5"
  },
  "shell": {
    "init_hook": [
      "[ -n \"${PROJ_INIT_SKIP:-}\" ] && return",
      ". \"$DEVBOX_PROJECT_ROOT/devbox-init.sh\""
    ]
  }
}

Devbox version

0.10.7

Nix version

nix (Nix) 2.18.2

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

No response