-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: devbox shell -p somepackage
#1465
Comments
This is interesting, and something we've discussed previously. A few questions for discussion:
|
I think you can make up whatever you want, as the most simple of use-cases (I want a shell with a package and I don't care how I get it) is probably all that is desired most of the time. This feature is dangerous if over-used or relied on too much, so it should very much be a one-off temporary thing. That said, I'd be happy to tell you what nix-shell does as inspiration:
I don't have a use-case that cares so I won't state my arbitrary preference. |
Cool feature!
Not my case, these projects don't have devbox.json (yet ;- )
Sure
I think yes |
Related to #1275 |
I created the following in my dbe () {
local pkgs="$@"
[ -z "$pkgs" ] && printf "dbe: missing argument.\nUsage: dbe PKG1 PKG2 ...\n" && return 255
local pkgs_sha256=$(echo "$pkgs" | sort | sha256sum | awk '{print $1}')
local configdir="${HOME}/.cache/devbox/ephemeral/${pkgs_sha256}"
mkdir -p "$configdir"
devbox init "$configdir"
devbox add -c "$configdir" $pkgs
devbox shell -c "$configdir"
} (dbe = DevBox Ephemeral) E.g.
My main use-case for this is a Terraform repository with a bunch of projects with different Terraform versions. |
Another usecase: I would love to use devbox for writing portable scripts (by leveraging shebangs). |
Wow I love that use case. |
See https://pkgx.sh/ for inspiration. |
|
Is your feature request related to a problem you're trying to solve? Please describe.
There are too many steps to testing out a package. I potentially potentially have to:
Describe the solution you'd like
I would like something equivalent to
nix-shell -p <package>
1 which allows you to temporarily, on only the current shell, have access to a package. I think the most obvious way to expose this is to havedevbox shell
take a-p
option that allows the same syntax as devbox.json packages, e.g.devbox shell -p ruby@3.2.2
should work.Describe alternatives you've considered
This doesn't enable anything new. It is just a convenience method.
Additional context
This was requested in #50 but I think that request got misinterpreted as having a way of running a one-off command on a temporary devbox shell and the part about having access to a package got missed.
Footnotes
https://nixos.org/manual/nix/stable/command-ref/nix-shell#options ↩
The text was updated successfully, but these errors were encountered: