Skip to main content
Devbox and Isolated Environments
  1. Posts/

Devbox and Isolated Environments

··
Table of Contents

I regularly download projects that I want to test from github. However, when I launch the crash project I don’t have the right version of the runtime used by the project dev. After tearing my hair out trying to install the right version and ruining half my OS in the process, I finally found an effective way of isolating my tests.

My savior is devbox, a new addition to my collection of open-source tools that allows creating isolated environments without any hassle.

Usage
#

Initialization
#

Once installed on our machine (Linux or Mac), it’s really simple. Just navigate to the folder of the software you want to use and run the following command.

devbox init

Devbox will create a small JSON file at the root that will look like this:

{
  "packages": [],
  "shell": {
    "init_hook": null
  },
  "nixpkgs": {
    "commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62"
  }
}

Manipulating Packages
#

Next, we can choose which packages we want to add to our isolated environment. For this, devbox relies on nix packages. We can find their names by searching the nix package repositories.

devbox add [package]

And now can can enter inside ou new environment.

devbox shell

And that’s it. Yes, you heard it right, that’s it. Just add the devbox.json to the git repository and your entire team can work with the same environment as you. No need for containers. 😜

More examples can be found in their documentation.

One last note, they have just released a preview system for deploying these environments remotely. I haven’t had the time to test it yet, but it can allow you to work on less powerful machines without any hassle.

50 Nuances d'Octets
Author
50 Nuances d’Octets
No bullshit 🛸
Author
Guillaume Assier
Tech, Cloud et Cybersécurité ⛅