Adding Devbox to your Project
Devbox is a command-line tool that lets you easily create reproducible, reliable dev environments. 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. Developers can start their dev environment by running
devbox shell within your project.
To learn more about how Devbox works, you can read our introduction
This Quickstart shows you how to install Devbox and use it to create a new Development Environment for your project.
Use the following install script to get the latest version of Devbox:
curl -fsSL https://get.jetpack.io/devbox | bash
Devbox requires the Nix Package Manager. If Nix is not detected on your machine when running a command, Devbox will automatically install it for you with the default settings for your OS. Don't worry: You can use Devbox without needing to learn the Nix Language.
Create a development environment
We'll create a new development environment with the packages we need. These packages will only be available when using this Devbox shell, ensuring we don’t pollute your machine.
Open a terminal in a new empty folder.
This creates a
devbox.jsonfile in the current directory. You should commit it to source control.
Search for packages to add to your Devbox project with
devbox search. For example, to search for Python packages, you can run the
devbox search python3
You can add a package to your project by running
devbox add <package>. For example, running the following will install the latest available version of Python in your project:
devbox add ripgrep
If you want to install a specific version of a package, you can run
devbox add <package>@<version>. For example, to install Python 3.10, you can run:
devbox add firstname.lastname@example.org
devbox.jsonfile keeps track of the packages you've added, it should now look like this:
Start a new shell that has your packages and tools installed:
The first time you run
devbox shellmay take a while to complete due to Devbox downloading prerequisites and package catalogs required by Nix. This delay is a one-time cost, and future invocations and package additions should resolve much faster.
You can tell you're in a Devbox shell (and not your regular terminal) because the shell prompt and directory changed.
Use your favorite packages.
In this example we installed Python 3.10, so let's use it.
$ python --version
We will also have the latest version of ripgrep installed in our shell:
$ rg --version
-SIMD -AVX (compiled)
Your regular tools are also available including environment variables and config settings.
git config --get user.name
To exit the Devbox shell and return to your regular shell:
To share your project and shell, make sure to check in your
devbox.lockfile into source control. These files will ensure that developers get the same packages and environment when they run your project.
Add the Devbox Badge to your Repo
Once you publish your Devbox project to Github, you can help other developers get started by adding the Devbox Badge to your repo. Please copy the code snippets below and paste them into your README.md to add the badge
[![Built with Devbox](https://jetpack.io/img/devbox/shield_galaxy.svg)](https://jetpack.io/devbox/docs/contributor-quickstart/)
alt="Built with Devbox"
[![Built with Devbox](https://jetpack.io/img/devbox/shield_moon.svg)](https://jetpack.io/devbox/docs/contributor-quickstart/)
alt="Built with Devbox"
Learn more about Devbox
- Devbox Global: Learn how to use the devbox as a global package manager
- Devbox Scripts: Automate setup steps and configuration for your shell using Devbox Scripts.
- Configuration Guide: Learn how to configure your shell and dev environment with
- Browse Examples: You can see how to create a development environment for your favorite tools or languages by browsing the Devbox Examples repo.
Use Devbox with your IDE
- Direnv Integration: Devbox can integrate with direnv to automatically activate your shell and packages when you navigate to your project.
- Devbox for Visual Studio Code: Install our VS Code extension to speed up common Devbox workflows or to use Devbox in a devcontainer.
- Join our Discord Community: Chat with the development team and our growing community of Devbox users.
- Visit us on Github: File issues and provide feedback, or even open a PR to contribute to Devbox or our Docs.