devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Q: Support for multiple devbox environments?

Open icosahedron opened this issue 3 years ago • 4 comments

Is it possible to have different environments with different shells? I move to a different directory and create a new devbox.json but running devbox shell still contains the installed packages from the original devbox.json.

Perhaps this is a question pertinent only to Rust? I installed Clojure via one of the shells and it didn't show in the other shell.

Edit: Okay, I think I have it sorted, but perhaps some clarification on how it works?

icosahedron avatar Aug 26 '22 05:08 icosahedron

Rust doesn't seem to work on macOS in a devbox shell. A simple default app created with cargo doesn't link properly. Not sure what the issue is. Probably on the Rust side?

icosahedron avatar Aug 26 '22 16:08 icosahedron

@icosahedron We do support different shells with different environments. I suspect you ran into an issue by accidentally calling devbox shell inside devbox shell. It's happened to us a few times internally.

We just released a new version of devbox that prevents you from making that mistake (shell-inception is what we call it)

Re: rust compilation, I can't tell if that's due to the nested shells ... or something else. Would you mind making sure you're not in a nested shell, and then trying to compile again? If it doesn't work:

  1. Would you be able to send me the output of env? (do scrub any sensitive env variables first) Mainly looking to see if there's something else interfering.
  2. Is there a sample rust project you could point me that is representative of what you're trying to do? That way I could try building it myself to see if I can get it to work.

loreto avatar Aug 26 '22 19:08 loreto

I too have been accidentally a few shells deep ¯_(ツ)_/¯, but the rust issue isn't related to that. (😆 at the name of shell inception). I've pushed a repo with the little project that I'm working on.

https://codeberg.org/icosahedron/rust-roguelike/src/branch/devbox

It fails linking with the errors cargo-build-error.txt

And here are the requested environment variables. devbox-env.txt

icosahedron avatar Aug 26 '22 23:08 icosahedron

I should state that I used devbox add rustup and then used that to install the Rust toolchain from inside devbox shell. It seems to install correctly, in that cargo and rustc are in nix directories?

icosahedron avatar Aug 26 '22 23:08 icosahedron

Hey @icosahedron, I did some digging and testing on my end, and I think the error you posted above is because AppKit framework is not available in your devbox shell. I was able to add it to my devbox by running:

devbox add darwin.apple_sdk.frameworks.AppKit

Can you try that in your project and see if that helps?

Lagoja avatar Aug 31 '22 04:08 Lagoja

Nice. Thanks for researching that. I guess I misunderstood how nix works. I thought it would pick up the existing installed framework, so I was trying to figure out how my path was wrong.

icosahedron avatar Aug 31 '22 21:08 icosahedron