Lurker News
Devbox is a command-line tool that lets you easily create isolated shells and containers. You start by defining the list of packages required by your development environment, and devbox uses that definition to create an isolated environment just for your application.

In practice, Devbox works similar to a package manager like yarn – except the packages it manages are at the operating-system level (the sort of thing you would normally install with brew or apt-get).
See it in action: https://youtu.be/WMBaXQZmDoA

Comments (185) 47 threads

Earlier comments
abathur1 reply#
@dloreto @robrich A little aside from the announcement, but since it seems like you both work on this I wanted to surface something that came up down in a subthread:

I'm curious if you attempted to support macOS by doing this with Nix's dockerTools and cross-compiling (there may be better sources, but it's at least hinted at in https://nix.dev/tutorials/building-and-running-docker-images...)? If so, I'm wondering where that failed or bogged down?
---
Background: I build a tool (https://github.com/abathur/resholve) for ~packaging Bash/Shell (i.e., for demanding all dependencies be present). The tool's technically agnostic, but I built it specifically to fix Shell packaging in Nix.
I think it could benefit a lot of other Shell projects, since one of Shell's big tribulations is dealing with heterogenous environments, but most Shell projects wouldn't see much reason to endure the pain of adopting Nix if they still had to support the heterogenous environments.
Much like you're doing here, I've been hoping to figure out how to build a Nix-based packaging flow that can generate deployable standalone bundles or containers. It'd be a heavy way to bundle Shell, but I imagine some projects would take the tradeoff for predictability and reduced support load. But since it would need to take place within a Nix build, I'd need to cross-compile for it to work on macOS. Hoping you know if it's a dead-end or not :)

dloreto1 reply#
Haven’t tried that yet. We started with using Docker directly because we were very familiar with it, and thought users might want to “preview” a dockerfile before asking devbox to build a container (we don’t have that yet, but can easily add it)

That said, I do want to experiment with building the container directly through nix and seeing if there’s advantages to doing that. I just haven’t had the time yet.

abathur#
Makes sense. I'll keep an eye out. Tilting at other windmills for now, myself. Congrats on the great start :)
alexanderdavide#
Shell environments, why didn't I thought about this earlier? I'll definitely enjoy this as soon as I've figured out the best way to integrate it with my development processes.

Usually, I use Viscose development containers where system programs are installed via Docker. However, it's quite tedious to manage installation and versioning of these programs.

sergiotapia2 replies#
This looks really cool! Can you explain the differences between `asdf` and the .tool-versions file?

I can currently add a .tool-versions file in my project folder and run `asdf install` to get everything on the same versions for all our devs.

    elixir 1.13.4
    erlang 24.3.4
    nodejs 16.4.2
qbasic_forever#
nix is in some ways a much more refined version of asdf. asdf is basically a wrapper around curling install scripts to bash. It can do anything--it might download a precompiled version of a tool, or it might build the tool entirely from scratch on your machine. It's up to whoever wrote the asdf package, and the quality of the packages there varies _a lot_.

nix goes the next step and has packages defined as an install script plus all their dependencies (all the way down to the basic C library, compilers, etc.). It caches everything based on a hash and provides a public repository where it will just download prebuilt versions of things instead of compiling them from scratch every time. It can do this because it has extremely strict hermeticity and reproducibility guarantees for all of its packages--asdf has none of this and you'll almost certainly just be compiling tools over and over or pulling down pre-built versions that will probably work (as long as you carefully read the package readme and installed all its dependencies).
Don't get me wrong, asdf is nice and great for simple things. If it works for you keep using it. If you start to run into trouble with the quality of its packages or you start writing your own packages, you might want to look at a more comprehensive system like nix.

pxc#
`asdf` shells out to a bunch of different language-specific package managers. `devbox` only shells out to Nix, which manages system dependencies (including native libraries) and language ecosystem dependencies in a uniform way. `asdf` doesn't manage deps like the libraries your nodejs packages that use C bindings for number crunching, or CLI utilities that aren't part of your languages' library ecosystems.

Also devbox can dump Docker containers for you

Load more comments