Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"nixpkgs": {
"commit": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3"
}
}
}
39 changes: 39 additions & 0 deletions docs/app/docs/cli_reference/devbox_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# devbox create

Initialize a directory as a devbox project using a template

## Synopsis

Initialize a directory as a devbox project. This will create an empty devbox.json in the current directory. You can then add packages using `devbox add`

```bash
devbox create [dir] --template <template> [flags]
```

## List of templates

* [**go**](https://github.com/jetpack-io/devbox/tree/main/examples/development/go)
* [**node-npm**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-npm/)
* [**node-typescript**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-typescript/)
* [**node-yarn**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-yarn/)
* [**php**](https://github.com/jetpack-io/devbox/tree/main/examples/development/php/)
* [**python-pip**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/pip/)
* [**python-pipenv**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/pipenv/)
* [**python-poetry**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/poetry/)
* [**ruby**](https://github.com/jetpack-io/devbox/tree/main/examples/development/ruby/)
* [**rust**](https://github.com/jetpack-io/devbox/tree/main/examples/development/rust/)


## Options

<!--Markdown Table of Options -->
| Option | Description |
| --- | --- |
| `-h, --help` | help for init |
| `-t, --template string` | Template to use for the project.
| `-q, --quiet` | Quiet mode: Suppresses logs. |

## SEE ALSO

* [devbox](./devbox.md) - Instant, easy, predictable shells and containers

19 changes: 19 additions & 0 deletions docs/app/docs/cli_reference/devbox_global_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# devbox global install

Install all packages mentioned in your global devbox.json.

```bash
devbox global install <pkg>... [flags]
```

## Options

<!-- Markdown Table of Options -->
| Option | Description |
| --- | --- |
| `-h, --help` | help for global install |
| `-q, --quiet` | suppresses logs |

## SEE ALSO

* [devbox global](devbox_global.md) - Manages global Devbox packages
37 changes: 37 additions & 0 deletions docs/app/docs/cli_reference/devbox_global_run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# devbox global run

Starts a new shell and runs your script or command in it, exiting when done.

The script must be defined in `devbox.json`, or else it will be interpreted as an arbitrary command. You can pass arguments to your script or command. Everything after `--` will be passed verbatim into your command (see example)

```bash
devbox global run <pkg>... [flags]
```

## Examples

Run a command directly:

```bash
devbox add cowsay
devbox global run cowsay hello
devbox global run -- cowsay -d hello
```

Run a script (defined as `"moo": "cowsay moo"`) in your devbox.json:

```bash
devbox global run moo
```

## Options

<!-- Markdown Table of Options -->
| Option | Description |
| --- | --- |
| `-h, --help` | help for global run |
| `-q, --quiet` | suppresses logs |

## SEE ALSO

* [devbox global](devbox_global.md) - Manages global Devbox packages
19 changes: 19 additions & 0 deletions docs/app/docs/cli_reference/devbox_global_services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# devbox global services

Interact with Devbox services for your global packages. This command replicates the subcommands for [devbox services](devbox_services.md) but for your global packages.

```bash
devbox global services [command]
```

## Options

<!-- Markdown Table of Options -->
| Option | Description |
| --- | --- |
| `-h, --help` | help for global services |
| `-q, --quiet` | suppresses logs |

## SEE ALSO

* [devbox global](devbox_global.md) - Manages global Devbox packages
27 changes: 27 additions & 0 deletions docs/app/docs/cli_reference/devbox_global_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# devbox global update

Updates packages in your Devbox global config to the latest available version.

## Synopsis

If you provide this command with a list of packages, it will update those packages to the latest available version based on the version tag provided.

For example: if your global config has `python@3.11` in your package list, running `devbox update` will update to the latest patch version of `python 3.11`.

If no packages are provided, this command will update all the versioned packages to the latest acceptable version.

```bash
devbox update [pkg]... [flags]
```

## Options

<!-- Markdown Table of Options -->
| Option | Description |
| --- | --- |
| `-h, --help` | help for update |
| `-q, --quiet` | suppresses logs |

## SEE ALSO

* [devbox global](devbox_global.md) - Manages global Devbox packages
67 changes: 35 additions & 32 deletions docs/app/docs/devbox_examples/databases/mariadb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: MariaDB
---
To use a local MariaDB for development with Devbox and Nix, you will need to configure MariaDB to install and manage the configuration locally. This can be done using Environment variables to create the data directory, pidfile, and unix sock locally.
MariaDB can be automatically configured for your dev environment by Devbox via the built-in MariaDB Plugin. This plugin will activate automatically when you install MariaDB using `devbox add mariadb`, or when you use a versioned Nix package like `devbox add mariadb_1010`

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/databases/mariadb)

Expand All @@ -13,47 +13,50 @@ To use a local MariaDB for development with Devbox and Nix, you will need to con

```json
"packages": [
"mariadb"
"mariadb@latest"
]
```

## Environment Variables
You can manually add the MariaDB Plugin to your `devbox.json` by adding it to your `includes` list:

This script should be sourced in the `init_hook` of our devbox.json. This sets environment variables needed to configure and start MariaDB, as well as setting the data directory to a local folder.

```bash
# Environment variables for running MariaDB with local configuration
export MYSQL_BASEDIR=$(which mariadb | sed -r "s/\/bin\/mariadb//g")
export MYSQL_HOME=$PWD/conf/mysql # or another folder in your project directory
# Store DB data in a local folder
export MYSQL_DATADIR=$MYSQL_HOME/data
# Keep the socket and pidfile in our conf folder, and out of the Nix Store
export MYSQL_UNIX_PORT=$MYSQL_HOME/mysql.sock
export MYSQL_PID_FILE=$MYSQL_HOME/mysql.pid
```json
"includes": [
"plugin:mariadb"
]
```

## Installing the Database
We can check if the MySQL data directory exists, and if not install the database using the environment variables we configured:
## MariaDB Plugin Support

Devbox will automatically create the following configuration when you run `devbox add mariadb`. You can view the full configuration by running `devbox info mariadb`

```bash
if [ ! -d "$MYSQL_DATADIR" ]; then
# Install the Database
mysql_install_db --auth-root-authentication-method=normal \
--datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR \
--pid-file=$MYSQL_PID_FILE
fi
```

## Starting the Daemon
Similarly, we can start the database using mysqld, passing the environment variables where needed
### Services
* mariadb

You can use `devbox services up|stop mariadb` to start or stop the MariaDB Server.

### Environment Variables

```bash
mysqld --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_PID_FILE \
--socket=$MYSQL_UNIX_PORT 2> $MYSQL_HOME/mysql.log & MYSQL_PID=$!
MYSQL_BASEDIR=.devbox/nix/profile/default
MYSQL_HOME=./.devbox/virtenv/mariadb/run
MYSQL_DATADIR=./.devbox/virtenv/mariadb/data
MYSQL_UNIX_PORT=./.devbox/virtenv/mariadb/run/mysql.sock
MYSQL_PID_FILE=./.devbox/mariadb/run/mysql.pid
```

The daemon can be terminated using `mysqladmin`:
### Files

```bash
mysqladmin -u root --socket=$MYSQL_UNIX_PORT shutdown
```
The plugin will also create the following helper files in your project's `.devbox/virtenv` folder:

* mariadb/flake.nix
* mariadb/setup_db.sh
* mariadb/process-compose.yaml

These files are used to setup your database and service, and should not be modified

### Notes

* This plugin wraps mysqld and mysql_install_db to work in your local project. For more information, see the `flake.nix` created in your `.devbox/virtenv/mariadb` folder.
* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init.
* You can use `mysqld` to manually start the server, and `mysqladmin -u root shutdown` to manually stop it
8 changes: 5 additions & 3 deletions docs/app/docs/devbox_examples/databases/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ PostgreSQL can be automatically configured by Devbox via the built-in Postgres P

```json
"packages": [
"postgresql",
"glibcLocales"
"postgresql@latest",
"glibcLocales@latest"
]
```

This will install the latest version of Postgres. You can find other installable versions of Postgres by running `devbox search postgresql`.

## PostgreSQL Plugin Support

Devbox will automatically create the following configuration when you run `devbox add postgresql`:
Expand All @@ -32,7 +34,7 @@ You can use `devbox services start|stop postgresql` to start or stop the Postgre
`PGHOST=./.devbox/virtenv/postgresql`
`PGDATA=./.devbox/virtenv/postgresql/data`

This variable tells PostgreSQL which directory to use for creating and storing databases.
This variable tells PostgreSQL which directory to use for creating and storing databases.

### Notes

Expand Down
6 changes: 4 additions & 2 deletions docs/app/docs/devbox_examples/databases/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ Redis can be configured automatically using Devbox's built in Redis plugin. This

```json
"packages": [
"redis"
"redis@latest "
],
```

This will install the latest version of Redis. You can find other installable versions of Redis by running `devbox search redis`.

## Redis Plugin Details

The Redis plugin will automatically create the following configuration when you install Redis with `devbox add`
Expand Down Expand Up @@ -48,4 +50,4 @@ Running `devbox services start redis` will start redis as a daemon in the backgr

You can manually start Redis in the foreground by running `redis-server $REDIS_CONF --port $REDIS_PORT`.

Logs, pidfile, and data dumps are stored in `.devbox/virtenv/redis`. You can change this by modifying the `dir` directive in `devbox.d/redis/redis.conf`
Logs, pidfile, and data dumps are stored in `.devbox/virtenv/redis`. You can change this by modifying the `dir` directive in `devbox.d/redis/redis.conf`
12 changes: 3 additions & 9 deletions docs/app/docs/devbox_examples/languages/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ C# and .NET projects can be easily generated in Devbox by adding the dotnet SDK

```json
"packages": [
"dotnet-sdk"
"dotnet-sdk@latest"
],
```
This will install .NET SDK 6.0

Other versions available include:

* dotnet-sdk_7 (version 7.0)
* dotnet-sdk_5 (version 5.0)
* dotnet-sdk_3 (version 3.1)
This will install the latest version of the dotnet SDK. You can find other installable versions of the dotnet SDK by running `devbox search dotnet-sdk`.

## Creating a new C# Project

`dotnet new console -lang "C#" -o <name>`
`dotnet new console -lang "C#" -o <name>`
16 changes: 5 additions & 11 deletions docs/app/docs/devbox_examples/languages/elixir.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Elixir
---

Elixir can be configured to install Hex and Rebar dependencies in a local directory. This will keep Elixir from trying to install in your immutable Nix Store:
Elixir can be configured to install Hex and Rebar dependencies in a local directory. This will keep Elixir from trying to install in your immutable Nix Store:

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/elixir/elixir_hello)

Expand All @@ -15,18 +15,12 @@ Elixir can be configured to install Hex and Rebar dependencies in a local direct

```json
"packages": [
"elixir",
"bash"
"elixir@latest",
"bash@latest"
],
```

This will install Elixir 1.13.
Other versions available include:

* elixir_1_10 (version 1.10)
* elixir_1_11 (version 1.11)
* elixir_1_12 (version 1.12)
* elixir_1_14 (version 1.14)
This will install the latest version of Elixir available. You can find other installable versions of Elixir by running `devbox search elixir`.

## Installing Hex and Rebar locally

Expand All @@ -46,4 +40,4 @@ Since you are unable to install Elixir Deps directly into the Nix store, you wil
}
```

This will create local folders and force mix to install your Hex and Rebar packages to those folders. Now when you are in `devbox shell`, you can install using `mix deps`.
This will create local folders and force mix to install your Hex and Rebar packages to those folders. Now when you are in `devbox shell`, you can install using `mix deps`.
12 changes: 3 additions & 9 deletions docs/app/docs/devbox_examples/languages/fsharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ F# and .NET projects can be easily generated in Devbox by adding the dotnet SDK

```json
"packages": [
"dotnet-sdk"
"dotnet-sdk@latest"
],
```
This will install .NET SDK 6.0

Other versions available include:

* dotnet-sdk_7 (version 7.0)
* dotnet-sdk_5 (version 5.0)
* dotnet-sdk_3 (version 3.1)
This will install the latest version of the dotnet SDK. You can find other installable versions of the dotnet SDK by running `devbox search dotnet-sdk`.

## Creating a new F# Project

`dotnet new console -lang "F#" -o <name>`
`dotnet new console -lang "F#" -o <name>`
Loading