Using Plugins
Built-in Plugins
If you add one of the packages listed below to your project usingdevbox add <pkg>
, Devbox will
automatically activate the plugin for that package.
You can also explicitly add a built-in plugin in your project by adding it to the
include
section of your devbox.json
file. For example, to
explicitly add the plugin for Nginx, you can add the following to your devbox.json
file:
devbox add <package_name>
- Apache (apacheHttpd)
- Caddy (caddy)
- Nginx (nginx)
- Node.js (nodejs, nodejs-slim)
- MariaDB (mariadb, mariadb_10_6…)
- MySQL (mysql80, mysql57)
- PostgreSQL (postgresql)
- Redis (redis)
- Valkey (valkey)
- PHP (php, php80, php81, php82…)
- Python (python, python-full, python-minimal…)
- Ruby(ruby, ruby_3_1, ruby_3_0…)
- Elixir(elixir, elixir_1_16, elixir_1_15…)
Local Plugins
You can also define your own plugins and use them in your project. To use a local plugin, add the following to theinclude
section of your devbox.json:
Github Hosted Plugins
Sometimes, you may want to share a plugin across multiple projects or users. In this case, you provide a Github reference to a plugin hosted on Github. To install a github hosted plugin, add the following to the include section of your devbox.jsondevbox shell
and similar commands, and avoids downloading the plugin from Github each time. In
extenuating circumstances, you can bypass this cache by setting
export DEVBOX_X_GITHUB_PLUGIN_CACHE_TTL=<time>
, where time is a valid input to
time.ParseDuration
(see doc) such as “120s” or “2m”.
An Example of a Plugin: Nginx
Let’s take a look at the plugin for Nginx. To get started, let’s initialize a new devbox project, and add thenginx
package:
nginx
plugin, and print a short explanation of the
plugin’s configuration
nginx
in our local shell. Let’s take a look at the files it created:
nginx.conf
and
fastcgi.conf
to customize how Nginx works.
We can also see in the info page that Devbox has configured an NGINX service for us. Let’s start
this service with devbox services start nginx
, and then test it with curl
:
Plugin Configuration in detail
When Devbox detects a plugin for an installed package, it automatically applies its configuration and prints a short explanation. Developers can review this explanation anytime usingdevbox info <package_name>
.
Services
If your package can run as a daemon or background service, Devbox can configure and manage that service for you withdevbox services
.
To learn more, visit our page on Devbox Services.
Environment Variables
Devbox stores default environment variables for your package in.devbox/virtenv/<package_name>/.env
in your project directory. Devbox automatically updates these
environment variables whenever you run devbox shell
or devbox run
to match your current project,
and developers should not check these .env
files into source control.
Customizing Environment Variables
If you want to customize the environment variables, you can override them in theinit_hook
of your
devbox.json
Helper Files
Helper files are files that your package may use for configuration purposes, such as NGINX’snginx.conf
file. When installing a package, Devbox will check for helper files in your project’s
devbox.d
folder and create them if they do not exist. If helper files are already present, Devbox
will not overwrite them.