Skip to content

Commit 59c2d6d

Browse files
LagojaLucilleH
andauthored
Update docs for 0.13 series (#2312)
## Summary * Update Services docs to include all new features (attach, port selection) * Document `--patch` flag and json config * Document installation via nix flake * Document Devbox Environment Variables ## How was it tested? localhost, `devbox run -- pnpm build` --------- Signed-off-by: John Lago <[email protected]> Co-authored-by: Lucille Hua <[email protected]>
1 parent 0ff66c1 commit 59c2d6d

File tree

10 files changed

+138
-43
lines changed

10 files changed

+138
-43
lines changed

docs/app/docs/cli_reference/devbox_add.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ devbox add prometheus --outputs=out,cli
3333
| `--environment string` | Jetify Secrets environment to use, when supported (e.g.secrets support dev, prod, preview.) (default "dev") |
3434
| `-e, --exclude-platform strings` | exclude packages from a specific platform. |
3535
| `-h, --help` | help for add |
36-
| `-o, --outputs strings` | specify the outputs to install for the nix package |
36+
| `-o, --outputs strings` | specify the outputs to install for the nix package |
3737
| `-p`, `--platform strings` | install packages only on specific platforms. |
38-
| `--patch-glibc` | Patches ELF binaries to use a newer version of `glibc` |
38+
| `--patch` | Allow Devbox to patch your packages to fix issues with missing native libraries (auto, always, never) (default "auto")|
3939
| `-q, --quiet` | quiet mode: Suppresses logs. |
4040

4141
Valid Platforms include:
@@ -54,4 +54,3 @@ The platforms below are also supported, but will build packages from source
5454
## SEE ALSO
5555

5656
* [devbox](./devbox.md) - Instant, easy, predictable shells and containers
57-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# devbox services attach
2+
3+
Attach to a running instance of `devbox services`. This command lets you launch the TUI for process-compose if you started your services in the background with `devbox services up -b`.
4+
5+
Note that terminating the TUI will not stop your backgrounded services. To stop your services, use `devbox services stop`.
6+
7+
```bash
8+
devbox services attach [flags]
9+
```
10+
11+
## Options
12+
13+
<!-- Markdown Table of Options -->
14+
| Option | Description |
15+
| --- | --- |
16+
| `-h, --help` | help for ls |
17+
| `-q, --quiet` | Quiet mode: Suppresses logs. |
18+
19+
### SEE ALSO
20+
21+
* [devbox services](devbox_services.md) - Interact with devbox services

docs/app/docs/cli_reference/devbox_services_up.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ devbox services up web
3131
| `-e, --env stringToString` | environment variables to set in the devbox environment (default []) |
3232
| `--env-file string` | path to a file containing environment variables to set in the devbox environment |
3333
| `-h, --help` | help for up |
34+
| `--pcflags stringArray` | additional flags to pass directly to process-compose |
35+
| `-p, --pcport int` | specify the port for process-compose to use. You can also set the pcport by exporting DEVBOX_PC_PORT_NUM |
3436
| `--process-compose-file string` | path to process compose file or directory containing process compose-file.yaml\|yml. Default is directory containing devbox.json |
3537
| `-q, --quiet` | Quiet mode: Suppresses logs. |
3638

3739
## SEE ALSO
3840

3941
* [devbox services](devbox_services.md) - Interact with devbox services
40-

docs/app/docs/configuration.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ Packages can be structured as a list of package names (`<packages>@<version>`) o
3636

3737
If you need to provide more options to your packages (such as limiting which platforms will install the package), you can structure packages as a map, where each package follows the schema below:
3838

39-
```json
39+
```js
4040
{
4141
"packages": {
4242
// If only a version is specified, you can abbreviate the maps as "package_name": "version"
4343
"package_name": string,
4444
"package_name": {
4545
// Version of the package to install. Defaults to "latest"
4646
"version": string,
47+
// Whether native library patching is enabled for this package. This defaults to `auto`, but can be overridden to `always` or `never` for individual packages.
48+
"patch": ["auto" | "always" | "never"],
4749
// List of platforms to install the package on. Defaults to all platforms
4850
"platforms": [string],
4951
// List of platforms to exclude this package from. Defaults to no excluded platforms
@@ -244,9 +246,9 @@ To run multiple commands in a single script, you can pass them as an array:
244246

245247
### Include
246248

247-
Includes can be used to explicitly add extra configuration from [plugins](./guides/plugins.md) to your Devbox project. Plugins are parsed and merged in the order they are listed.
249+
Includes can be used to explicitly add extra configuration from [plugins](./guides/plugins.md) to your Devbox project. Plugins are parsed and merged in the order they are listed.
248250

249-
Note that in the event of a conflict, plugins near the end of the list will override plugins at the beginning of the list. Likewise, if a setting in your project config conflicts with a plugin (e.g., your `devbox.json` has a script with the same name as a plugin script), your project config will take precedence.
251+
Note that in the event of a conflict, plugins near the end of the list will override plugins at the beginning of the list. Likewise, if a setting in your project config conflicts with a plugin (e.g., your `devbox.json` has a script with the same name as a plugin script), your project config will take precedence.
250252
```json
251253
{
252254
"include": [

docs/app/docs/devbox_examples/languages/go.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Go projects can be run in Devbox by adding the Go SDK to your project. If your p
2020

2121
This will install the latest version of the Go SDK. You can find other installable versions of Go by running `devbox search go`. You can also view the available versions on [Nixhub](https://www.nixhub.io/packages/go)
2222

23-
If you need additional C libraries, you can add them along with `gcc` to your package list. For example, if libcap is required for yoru project:
23+
If you need additional C libraries, you can add them along with `gcc` to your package list. For example, if libcap is required for your project:
2424

2525
```json
2626
"packages": [
@@ -32,9 +32,9 @@ If you need additional C libraries, you can add them along with `gcc` to your pa
3232

3333
## Installing go packages that have CLIs
3434

35-
Installing go packages in your devbox shell is as simple as `go get <package_name>` but some packages come with a CLI of their own (e.g., `godotenv`). That means after installing the package you should be able to use the CLI binary and also control where that binary is installed. This is done by setting `$GOPATH` or `$GOBIN` env variable.
35+
Installing go packages in your devbox shell is as simple as `go get <package_name>` but some packages come with a CLI of their own (e.g., `godotenv`). That means after installing the package you should be able to use the CLI binary and also control where that binary is installed. This is done by setting `$GOPATH` or `$GOBIN` env variable.
3636

37-
With Devbox you can set these variables in the `"env"` section of your `devbox.json` file.
37+
With Devbox you can set these variables in the `"env"` section of your `devbox.json` file.
3838
In the example below we are setting `$GOPATH` to be the same directory of our project and therefore `godotenv` binary will be located in the `bin/` subdirectory of `$GOPATH`:
3939

4040
```json

docs/app/docs/env_variables.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Devbox Env Variables
3+
---
4+
5+
The following is a list of Environment variables used by Devbox to manage your environment. Some of these variables are set by Devbox, while others can be used to manage how Devbox sets up your shell.
6+
7+
Note that this list only describes variables that are set by Devbox itself. [Devbox plugins](/guides/plugins) may set their own environment variables, which are documented in their respective pages and via `devbox info <package>`.
8+
9+
## Environment Variables Set by Devbox Shell
10+
11+
Below are some useful environment variables that Devbox sets up for you. These variables can be used in your scripts to access information or write scripts for your current project environment.
12+
13+
| Variable | Description |
14+
|:--------|:-----------|
15+
|`DEVBOX_CONFIG_DIR`| The directory where Devbox stores user-editable config files for your project's packages. These files can be checked into source control |
16+
|`DEVBOX_PACKAGES_DIR`| The directory containing the binaries and files for the packages in your current project |
17+
| `DEVBOX_PROJECT_ROOT` | The root directory of your current project. This will match the directory location of the `devbox.json` file for your currently running shell |
18+
| `DEVBOX_PURE_SHELL` | Indicates whether you are running your current shell in pure mode. Pure mode clears your current environment variables before starting a devbox shell |
19+
| `DEVBOX_SHELL_ENABLED` | Whether or not Devbox is enabled in the current shell. This is automatically set to `1` when you start a shell, run a script, or start services |
20+
| `DEVBOX_WD` | Your current working directory. This can be used when writing scripts that you want to run in your current directory, instead of DEVBOX_PROJECT_ROOT |
21+
22+
23+
## Environment Variables for Managing Devbox
24+
25+
Below are some environment variables that can be used to manage how Devbox sets up your shell. These variables can be set in your shell or in your `devbox.json` file.
26+
27+
| Variable | Description | Value |
28+
|:--------|:-----------|:------------|
29+
|`DEVBOX_DEBUG` | Enable debug output for Devbox. If set to 1, this will print out additional information about what Devbox is doing. | 0 |
30+
|`DEVBOX_FEATURE_DETSYS_INSTALLER` | If enabled, Devbox will use the Determinate Systems installer to setup Nix on your system. _This variable must be set on your host_ | 0 |
31+
|`DEVBOX_NO_PROMPT` | Disables the default shell prompt modification for Devbox. Usually used if you want to configure your own prompt for indicating that you are in a devbox sell | 0 |
32+
|`DEVBOX_PC_PORT_NUM` | Sets the port number for process-compose when running Devbox services. If this variable is unset and a port is not provided via the CLI, Devbox will choose a random available port | `unset` |
33+
|`DEVBOX_USE_VERSION` | Setting this variable will force Devbox to use a different version than the current latest. For example: `DEVBOX_USE_VERSION=0.13.0` will install and use Devbox v0.13 for all Devbox commands. _This variable must be set on your host_ | `unset`|

docs/app/docs/faq.md

+19-14
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,52 @@ Yes! Devbox can be installed on any Linux distribution, including NixOS. You can
3131

3232
## A package I installed is missing header files or libraries I need for development. Where do I find them?
3333

34-
In order to save space, Devbox and Nix only install the required components of packages by default. Development header files and libraries are often installed in a separate output of the package (usually `dev`), which can be installed using the `--output` flag on the `devbox add` command.
34+
In order to save space, Devbox and Nix only install the required components of packages by default. Development header files and libraries are often installed in a separate output of the package (usually `dev`), which can be installed using the `--output` flag on the `devbox add` command.
3535

36-
For example, the command below will install both the default output `out`, and the `cli` output for the prometheus package:
36+
For example, the command below will install both the default output `out`, and the `cli` output for the prometheus package:
3737

3838
```bash
3939
devbox add prometheus --outputs=out,cli
4040
```
4141

42-
You can also specify non-default outputs in [flake references](./guides/using_flakes.md):
42+
You can also specify non-default outputs in [flake references](./guides/using_flakes.md):
4343

4444
```bash
4545
devbox add github:NixOS/nixpkgs#prometheus^out,cli
4646
```
4747

4848
## One of my project's packages is taking a long time to install. How can I speed up the installation process?
4949

50-
Packages may take a long time to install if they do not have a binary available in the public Nix Cache. If a prebuilt binary is not available, Nix will built the package from source.
50+
Packages may take a long time to install if they do not have a binary available in the public Nix Cache. If a prebuilt binary is not available, Nix will built the package from source.
5151

5252
If prebuilt binaries are not available in the public cache, you may want to use the [Jetify Cache](./cloud/cache/index.md) or the [Jetify Prebuilt Cache](./cloud/cache/prebuilt_cache.md) to cache the binaries you build for future use. Using a package cache can reduce package install by up to 90% compared to building from source.
5353

5454
## I'm trying to build a project, but it says that I'm missing `libstdc++`. How do I install this library in my project?
5555

56-
This message means that your project requires an implementation of the C++ Standard Library installed and linked within your shell. You can add the libstdc++ libraries and object files using `devbox add stdenv.cc.cc.lib`.
56+
This message means that your project requires an implementation of the C++ Standard Library installed and linked within your shell. You can add the libstdc++ libraries and object files using `devbox add stdenv.cc.cc.lib`.
5757

58-
## I'm seeing a ``GLIBC_X.XX' not found` error when I try to install my packages, or when I install packages from PyPi/RubyGems/NPM/Cargo/other package manager in my shell
58+
## I'm seeing errors like ``GLIBC_X.XX' not found` when I try to install my packages, or when I install packages from PyPi/RubyGems/NPM/Cargo/other package manager in my shell
5959

60-
This message usually occurs when using older packages, or when mixing different versions of packages within a single shell. The error tends to occur because each Nix package comes bundled with all of it's dependencies, including a version of the C Standard Library, to ensure reproducibility. If your interpreter (Python/Ruby/Node) or runtime is using an older version of `glibc` than what your other packages expect, they will throw this error.
60+
This message usually occurs when using older packages, or when mixing different versions of packages within a single shell. The error tends to occur because each Nix package comes bundled with all of it's dependencies, including a version of the C Standard Library, to ensure reproducibility. If your interpreter (Python/Ruby/Node) or runtime is using an older version of `glibc` than what your other packages expect, they will throw this error.
6161

62-
There are three ways to work around this issue:
63-
1. You can update your packages to use a newer version (using `devbox add`). This newer version will likely come bundled with a newer version of `glibc`.
62+
There are three ways to work around this issue:
63+
1. You can update your packages to use a newer version (using `devbox add`). This newer version will likely come bundled with a newer version of `glibc`.
6464
2. You can use `devbox update` to get the latest Nix derivation for your package. Newer derivations may come bundled with newer dependencies, including `glibc`
65-
3. If you need to use an exact package version, but you still see this error, you can patch it to use a newer version of glibc using `devbox add <package>@<version> --patch-glibc`. This will patch your package to use a newer version of glibc, which should resolve any incompatibility issues you might be seeing. **This patch will only affect packages on Linux.**
65+
3. If you need to use an exact package version, but you still see this error, you can patch it to use a newer version of glibc using `devbox add <package>@<version> --patch always`. This will patch your package to use the latest version of glibc available in the Nix store, as well as patching it to use any native libraries you have installed with Devbox.
6666

6767
## How can I use custom Nix packages or overrides with Devbox?
6868

6969
You can add customized packages to your Devbox environment using our [Flake support](./guides/using_flakes.md). You can use these flakes to modify or override packages from nixpkgs, or to create your own custom packages.
7070

7171
## Can I use Devbox if I use [Fish](https://fishshell.com/)?
7272

73-
Yes. In addition to supporting POSIX compliant shells like Zsh and Bash, Devbox also works with Fish.
73+
Yes. In addition to supporting POSIX compliant shells like Zsh and Bash, Devbox also works with Fish.
7474

75-
Note that `init_hooks` in Devbox will be run directly in your host shell, so you may have encounter some compatibility issues if you try to start a shell that uses a POSIX-compatible script in the init_hook.
75+
Note that `init_hooks` in Devbox will be run directly in your host shell, so you may have encounter some compatibility issues if you try to start a shell that uses a POSIX-compatible script in the init_hook.
7676

7777
## How can I rollback to a previous version of Devbox?
7878

79-
You can use any previous version of Devbox by setting the `DEVBOX_USE_VERSION` environment variable. For example, to use version 0.8.0, you can run the following or add it to your shell's rcfile:
79+
You can use any previous version of Devbox by setting the `DEVBOX_USE_VERSION` environment variable. For example, to use version 0.8.0, you can run the following or add it to your shell's rcfile:
8080

8181
```bash
8282
export DEVBOX_USE_VERSION=0.8.0
@@ -92,7 +92,12 @@ By default, Devbox will prefix your prompt with `(devbox)` when inside a `devbox
9292
DEVBOX_NO_PROMPT=true
9393
```
9494

95-
You can now detect being inside a `devbox shell` and change your prompt using the method of your choosing.
95+
If you are using Fish:
96+
97+
```fish
98+
set -U devbox_no_prompt true
99+
```
100+
96101

97102
## How can I uninstall Devbox?
98103

docs/app/docs/guides/services.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ You can also start a specific service by passing the name as an argument. For ex
1616

1717
If you want to restart your services (for example, after changing your configuration), you can run `devbox services restart`
1818

19+
## Starting your Services in the Background
20+
21+
If you want to start your services in the background, without launching the process-compose TUI, you can use the `-b` flag. For example, to start all services in the background, you can run `devbox services up -b`.
22+
23+
Services started in the background will continue running, even if the current shell is closed. To stop your backgrounded services, run `devbox services stop`.
24+
25+
To see the current state of your running services, you can run `devbox services ls`.
26+
27+
You can also attach the process-compose TUI to your running background services by running `devbox services attach`.
28+
1929
## Defining your Own Services
2030

2131
If you have a process or service that you want to run with your Devbox project, you can define it using a process-compose.yml in your project's root directory. For example, if you want to run a Django server, you could add the following yaml:
@@ -76,8 +86,6 @@ You can stop your services with `devbox services stop`. This will stop process-c
7686

7787
If you want to stop a specific service, you can pass the name as an argument. For example, to stop just `postgresql`, you can run `devbox services stop postgresql`
7888

79-
80-
8189
## Further Reading
8290

8391
* [**Devbox Services CLI Reference**](../cli_reference/devbox_services.md)

0 commit comments

Comments
 (0)