BlogProduct update

Devbox 0.2.0: Automatic Nix Installer, Plugins, and Background Services

Author

John Lago@jetpack_john

Dec 20, 20223 min read

We are pleased to announce our end of the year release, Devbox 0.2.0.  This release is one of our biggest yet, packed with features designed to help developers get up and running with Nix based dev environments.

Some of the features included in this release are:

  1. Automatic Nix Installer: Devbox can now detect if Nix is installed on your machine, and will automatically install it for you if needed.

  2. Devbox Plugins: A framework for automatically configuring your packages, with initial support for Apache, Nginx, PostgreSQL and more.

  3. Devbox Services: Manage background services (like servers and databases) for your project with a single command.

  4. Generate Dockerfiles and Devcontainers: Need to run your environment in Docker? Generate a Dockerfile or devcontainer.json directly from the CLI.

If you already have Devbox installed, it should automatically update to 0.2.0 the next time you run it. If don't already have the Devbox, you can follow the installation instructions here.

Automatic Nix Installer

One major piece of feedback we received from early adopters (especially those who were unfamiliar with Nix) was that they found the initial installation of the Nix Package Manager confusing and challenging. To reduce this friction in getting started, Devbox can now install Nix for you automatically. Developers can now get up and running with Devbox using a single installer.

Devbox can now install Nix for you automatically

Devbox will try to detect Nix  when running a command that requires it (such as devbox add or devbox shell ).  If it does not find an installation on your machine, you will be prompted to install Nix using the default configuration for your OS.

Instant package configuration with Devbox Plugins

This release has the first version of what we're calling Devbox Plugins. Plugins bundle default configuration (like environment variables, configuration files, and services) with packages and apply it when you install them with devbox add. Plugins make getting started with packages like NGINX or Postgresql much faster.

Let's try adding Nginx to our Devbox shell. When we run devbox add nginx, Devbox will use the Nginx plugin to configure our environment and create a default nginx.conf file for our project. The plugin will also add a service to our shell (see below), so we can quickly start and stop Nginx when testing our project:

Adding and running NGINX made easy with Devbox Plugins

Our initial release includes plugins for the following packages, with many more to come.

We are also planning to open and provide a public repo for plugins, so developers can contribute plugins, or even add their own private plugins to Devbox.

Manage your Background Services with Devbox

When working on an application, you often want some services or dependencies running in the background for testing. Take a web app as an example. While working on your application, you will want to test it against a running development server and database. Previously developers would manage these services via tools like Docker Compose or orchestrating them manually.

Devbox 0.2.0 includes a devbox services subcommand for starting and stopping services within your Devbox Shell. Packages installed in your shell that have services configured via a Devbox Plugin will appear when you run devbox services ls. You can start these services using devbox start and stop them using devbox stop.

Starting all the services for a webapp with Devbox Services

Right now, developers can only configure services via plugins. Future releases will make it possible to define and manage services in your project's devbox.json.

Generate Dockerfiles and Devcontainers from the Devbox CLI

You can now generate a generic Dockerfile or Devcontainer for your project using the devbox generate command. These Dockerfiles make it easy to build your Devbox Shell environment as a portable container, so you can develop your project anywhere.

What's Next for Devbox

Our upcoming development cycle will focus on expanding our plugin support and adding greater flexibility for configuring packages. We will also continue to focus on improving our first run user experience, especially for developers who are new to the Nix Ecosystem.

We'd love to hear your feedback and As always, we welcome issues and pull requests on Github. You can also join our Discord Server to chat with the development team and community.

SHARE THIS ARTICLE
Author

John Lago@jetpack_john

Head of Product at Jetify

Recent Articles