jetify-com / devbox

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

[Bug]: Devbox placing files in directories outside .devbox #1676

Open hb0nes opened 7 months ago

hb0nes commented 7 months ago

Current Behavior (bug) Devbox is putting files in locations outside of the expected directory:

11:19:52|production|root@ld4-dev-01:~/stream_bench# ls -lrth /usr/bin/.rustup/ | head -5
total 20K
drwxr-xr-x 3 root root 4.0K Dec  7 11:19 toolchains
drwxr-xr-x 2 root root 4.0K Dec  7 11:19 tmp
drwxr-xr-x 2 root root 4.0K Dec  7 11:19 update-hashes
-rw-r--r-- 1 root root  102 Dec  7 11:19 settings.toml
11:21:06|production|root@ld4-dev-01:~/stream_bench# rm -rf /usr/bin/.rustup
11:21:22|production|root@ld4-dev-01:~/stream_bench# devbox shell
Starting a devbox shell...
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2023-11-16, rust version 1.74.0 (79e9716c9 2023-11-13)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
...
# ctrl + d to exit devbox shell
11:22:37|production|root@ld4-dev-01:~/stream_bench# ls -lrth /usr/bin/.rustup | head -5
total 20K
drwxr-xr-x 3 root root 4.0K Dec  7 11:21 toolchains
drwxr-xr-x 2 root root 4.0K Dec  7 11:21 tmp
drwxr-xr-x 2 root root 4.0K Dec  7 11:21 downloads
drwxr-xr-x 2 root root 4.0K Dec  7 11:21 update-hashes

Expected Behavior (fix) I would expect devbox shell to keep all files and dependencies in the directory that contains devbox.json.

Additional context

11:22:19|production|root@ld4-dev-01:~/stream_bench# devbox version -v
Version:     0.8.3
Platform:    linux_amd64
Commit:      a45f27deacd8e287f92babc9d0737161a992a5e1
Commit Time: 2023-12-05T19:47:54Z
Go Version:  go1.21.4
Launcher:    0.2.0
11:22:22|production|root@ld4-dev-01:~/stream_bench# cat devbox.json
{
    "packages": [
        "rustup@latest",
        "libiconv@latest"
    ],
    "shell": {
        "init_hook": [
            "projectDir=$(dirname $(readlink -f \"$0\"))",
            "rustupHomeDir=\"$projectDir\"/.rustup",
            "mkdir -p $rustupHomeDir",
            "export RUSTUP_HOME=$rustupHomeDir",
            "export LIBRARY_PATH=$LIBRARY_PATH:\"$projectDir/nix/profile/default/lib\"",
            "rustup default stable",
            "cargo fetch"
        ]
    }
}
rotivleal commented 4 months ago

Same here. And this also made me ponder that using devbox/nix-shell does not suffice as a true "development environment" :/