Skip to content

Commit eed56cd

Browse files
LagojaLucilleH
andauthored
0.10.0 Docs (#1900)
## Summary Update docs and examples for Devbox 0.10.0 ## How was it tested? Localhost + Vercel. Also ran lint --------- Signed-off-by: John Lago <[email protected]> Co-authored-by: Lucille Hua <[email protected]>
1 parent 6758504 commit eed56cd

25 files changed

+13343
-9639
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ __pycache__/
3737

3838
# deployment
3939
.vercel
40+
.yarn

docs/app/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

docs/app/devbox.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"packages": {
3-
"nodejs": "latest",
4-
"yarn": "latest"
5-
}
2+
"packages": ["nodejs@latest"]
63
}

docs/app/devbox.lock

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,67 @@
22
"lockfile_version": "1",
33
"packages": {
44
"nodejs@latest": {
5-
"last_modified": "2024-01-27T14:55:31Z",
6-
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#nodejs_21",
5+
"last_modified": "2024-02-24T23:06:34Z",
6+
"plugin_version": "0.0.1",
7+
"resolved": "github:NixOS/nixpkgs/9a9dae8f6319600fa9aebde37f340975cab4b8c0#nodejs_21",
78
"source": "devbox-search",
8-
"version": "21.6.1",
9+
"version": "21.6.2",
910
"systems": {
1011
"aarch64-darwin": {
11-
"store_path": "/nix/store/vj049qiv5cxhl4xp6vn09wd5jjg4z0cy-nodejs-21.6.1"
12+
"outputs": [
13+
{
14+
"name": "out",
15+
"path": "/nix/store/n9xcy53g63rk8vwb2yx5fb7i72rprpd1-nodejs-21.6.2",
16+
"default": true
17+
},
18+
{
19+
"name": "libv8",
20+
"path": "/nix/store/i7dqylwl31kbb4ixlz3d7iz28gkiz1pa-nodejs-21.6.2-libv8"
21+
}
22+
],
23+
"store_path": "/nix/store/n9xcy53g63rk8vwb2yx5fb7i72rprpd1-nodejs-21.6.2"
1224
},
1325
"aarch64-linux": {
14-
"store_path": "/nix/store/nyxyfn7nn685xgssfgdmg089hg1xg6ag-nodejs-21.6.1"
26+
"outputs": [
27+
{
28+
"name": "out",
29+
"path": "/nix/store/mqvmpikgnk7bxvi977ysd0z81bjpflzj-nodejs-21.6.2",
30+
"default": true
31+
},
32+
{
33+
"name": "libv8",
34+
"path": "/nix/store/bk213z877b7cx8m5hcb3pplry6bfz48b-nodejs-21.6.2-libv8"
35+
}
36+
],
37+
"store_path": "/nix/store/mqvmpikgnk7bxvi977ysd0z81bjpflzj-nodejs-21.6.2"
1538
},
1639
"x86_64-darwin": {
17-
"store_path": "/nix/store/nz7adglsj80d1j6b3v1g91fqj07ja7q0-nodejs-21.6.1"
40+
"outputs": [
41+
{
42+
"name": "out",
43+
"path": "/nix/store/mdwxb1kdajvahhbpq3dhnaf3b01h7yb8-nodejs-21.6.2",
44+
"default": true
45+
},
46+
{
47+
"name": "libv8",
48+
"path": "/nix/store/qnflfa9zq3d2z81zhlig0m7kb7w68csc-nodejs-21.6.2-libv8"
49+
}
50+
],
51+
"store_path": "/nix/store/mdwxb1kdajvahhbpq3dhnaf3b01h7yb8-nodejs-21.6.2"
1852
},
1953
"x86_64-linux": {
20-
"store_path": "/nix/store/nmfhr4pxgizjwdp6jnqa3l7f2bqplni3-nodejs-21.6.1"
21-
}
22-
}
23-
},
24-
"yarn@latest": {
25-
"last_modified": "2024-01-27T14:55:31Z",
26-
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#yarn",
27-
"source": "devbox-search",
28-
"version": "1.22.19",
29-
"systems": {
30-
"aarch64-darwin": {
31-
"store_path": "/nix/store/iziyl1h8zmhlgpk2gj72v0yl2ywix86g-yarn-1.22.19"
32-
},
33-
"aarch64-linux": {
34-
"store_path": "/nix/store/3x19j9fym9nq55smx9bka4lp781zalxi-yarn-1.22.19"
35-
},
36-
"x86_64-darwin": {
37-
"store_path": "/nix/store/5pyd85i7iwdpsra4c6hqn9qza9sbpnj2-yarn-1.22.19"
38-
},
39-
"x86_64-linux": {
40-
"store_path": "/nix/store/l9qbkva7zmqs4gabzwq3b0r3s532p8wa-yarn-1.22.19"
54+
"outputs": [
55+
{
56+
"name": "out",
57+
"path": "/nix/store/va3sggfgfb709lm31bzvpjfyapjdy435-nodejs-21.6.2",
58+
"default": true
59+
},
60+
{
61+
"name": "libv8",
62+
"path": "/nix/store/xl576mlrf1vhy9pz5xy9w9bq4l23vrx2-nodejs-21.6.2-libv8"
63+
}
64+
],
65+
"store_path": "/nix/store/va3sggfgfb709lm31bzvpjfyapjdy435-nodejs-21.6.2"
4166
}
4267
}
4368
}

docs/app/docs/cli_reference/devbox_add.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ devbox add glibcLocales --platform x86_64-linux,aarch64-linux
1717

1818
# Exclude busybox from installation on macOS
1919
devbox add busybox --exclude-platform aarch64-darwin,x86_64-darwin
20+
21+
# Install non-default outputs for a package, such as the promtool CLI
22+
devbox add prometheus --outputs=out,cli
2023
```
2124

2225
## Options
@@ -28,8 +31,10 @@ devbox add busybox --exclude-platform aarch64-darwin,x86_64-darwin
2831
| `-c, --config string` | path to directory containing a devbox.json config file |
2932
| `-e, --exclude-platform strings` | exclude packages from a specific platform. |
3033
| `-h, --help` | help for add |
31-
| `-q, --quiet` | quiet mode: Suppresses logs. |
34+
| `-o, --outputs strings` | specify the outputs to install for the nix package |
3235
| `-p`, `--platform strings` | install packages only on specific platforms. |
36+
| `--patch-glibc` | Patches ELF binaries to use a newer version of `glibc` |
37+
| `-q, --quiet` | quiet mode: Suppresses logs. |
3338

3439
Valid Platforms include:
3540

docs/app/docs/cli_reference/devbox_create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ devbox create [dir] --template <template> [flags]
3030
| Option | Description |
3131
| --- | --- |
3232
| `-h, --help` | help for init |
33-
| `-t, --template string` | Template to use for the project.
33+
| `-t, --template string` | Template to use for the project.|
3434
| `-q, --quiet` | Quiet mode: Suppresses logs. |
3535

3636
## SEE ALSO

docs/app/docs/cli_reference/devbox_services_up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ 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-
| `--process-compose-file string` | path to process compose file or directory containing process compose-file.yaml|yml. Default is directory containing devbox.json |
34+
| `--process-compose-file string` | path to process compose file or directory containing process compose-file.yaml\|yml. Default is directory containing devbox.json |
3535
| `-q, --quiet` | Quiet mode: Suppresses logs. |
3636

3737
## SEE ALSO

docs/app/docs/configuration.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ Your devbox configuration is stored in a `devbox.json` file, located in your pro
1313
"init_hook": "...",
1414
"scripts": {}
1515
},
16-
"include": [],
17-
"nixpkgs": {
18-
"commit": "..."
19-
}
16+
"include": []
2017
}
2118
```
2219

@@ -230,26 +227,23 @@ To run multiple commands in a single script, you can pass them as an array:
230227

231228
### Include
232229

233-
Includes can be used to explicitly add extra configuration or plugins to your Devbox project. Currently this only supports adding our [built-in plugins](guides/plugins.md) to your project.
234-
235-
You should use this section to activate plugins when you install a package from a [Flake](guides/using_flakes.md) that uses a plugin. To ensure that a plugin is activated for your project, add it to the `include` section of your `devbox.json`. For example, to explicitly activate the PHP plugin, you can add the following to your `devbox.json`:
230+
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.
236231

232+
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.
237233
```json
238234
{
239235
"include": [
236+
// Include a plugin from a Github Repo. The repo must have a plugin.json in it's root,
237+
// or in the directory specified by ?dir
238+
"github:org/repo/ref?dir=<path-to-plugin>"
239+
// Include a local plugin. The path must point to a plugin.json
240+
"path:path/to/plugin.json"
241+
// Force activate a builtin plugin
240242
"plugin:php-config"
241243
]
242244
}
243245
```
244246

245-
### Nixpkgs
246-
247-
The Nixpkg object is used to optionally configure which version of the Nixpkgs repository you want Devbox to use as the default for installing packages. It currently takes a single field, `commit`, which takes a commit hash for the specific revision of Nixpkgs you want to use.
248-
249-
If a Nixpkg commit is not set, Devbox will automatically add a default commit hash to your `devbox.json`. To upgrade your packages to the latest available versions in the future, you can replace the default hash with the latest nixpkgs-unstable hash from https://status.nixos.org.
250-
251-
To learn more, consult our guide on [setting the Nixpkg commit hash](guides/pinning_packages.md).
252-
253247
### Example: A Rust Devbox
254248

255249
An example of a devbox configuration for a Rust project called `hello_world` might look like the following:

docs/app/docs/devbox_examples/languages/nodejs.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Most NodeJS Projects will install their dependencies locally using NPM or Yarn,
88

99
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/node-npm)
1010

11-
1211
## Adding NodeJS to your Shell
1312

1413
`devbox add nodejs`, or in your `devbox.json`:
14+
1515
```json
1616
"packages": [
1717
"nodejs@18"
@@ -20,20 +20,35 @@ Most NodeJS Projects will install their dependencies locally using NPM or Yarn,
2020

2121
This will install NodeJS 18, and comes bundled with `npm`. You can find other installable versions of NodeJS by running `devbox search nodejs`. You can also view the available versions on [Nixhub](https://www.nixhub.io/packages/nodejs)
2222

23-
## Adding Yarn as your Package Manager
23+
## Adding Yarn, NPM, or pnpm as your Node Package Manager
2424

25-
[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-yarn)
25+
We recommend using [Corepack](https://github.com/nodejs/corepack/) to install and manage your Node Package Manager in Devbox. Corepack comes bundled with all recent Nodejs versions, and you can tell Devbox to automatically configure Corepack using a built-in plugin. When enabled, corepack binaries will be installed in your project's `.devbox` directory, and automatically added to your path.
2626

27-
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/node-yarn)
27+
To enable Corepack, set `DEVBOX_COREPACK_ENABLED` to `true` in your `devbox.json`:
2828

29-
`devbox add yarn`, or in your `devbox.json` add:
3029
```json
31-
"packages": [
32-
"nodejs@18",
33-
"yarn@latest"
34-
],
30+
{
31+
"packages": ["nodejs@18"],
32+
"env": {
33+
"DEVBOX_COREPACK_ENABLED": "true"
34+
}
35+
}
3536
```
3637

38+
To disable Corepack, remove the `DEVBOX_COREPACK_ENABLED` variable from your devbox.json
39+
40+
### Yarn
41+
42+
[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-yarn)
43+
44+
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/node-yarn)
45+
46+
### pnpm
47+
48+
[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-pnpm)
49+
50+
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/node-pnpm)
51+
3752
## Installing Global Packages
3853

3954
In some situations, you may want to install packages using `npm install --global`. This will fail in Devbox since the Nix Store is immutable.
@@ -42,10 +57,10 @@ You can instead install these global packages by adding them to the list of pack
4257

4358
```json
4459
{
45-
"packages": [
46-
"nodejs@18",
47-
"nodePackages.yalc@latest",
48-
"nodePackages.pm2@latest"
49-
]
60+
"packages": [
61+
"nodejs@18",
62+
"nodePackages.yalc@latest",
63+
"nodePackages.pm2@latest"
64+
]
5065
}
5166
```

docs/app/docs/faq.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,33 @@ 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 [Flake References](./guides/using_flakes.md).
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-
You can learn more about non-default outputs [here](./guides/using_flakes.md#installing-additional-outputs-from-a-flake).
36+
For example, the command below will install both the default output `out`, and the `cli` output for the prometheus package:
37+
38+
```bash
39+
devbox add prometheus --outputs=out,cli
40+
```
41+
42+
You can also specify non-default outputs in [flake references](./guides/using_flakes.md):
43+
44+
```bash
45+
devbox add github:NixOS/nixpkgs#prometheus^out,cli
46+
```
3747

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

4050
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`.
4151

52+
## 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
53+
54+
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.
55+
56+
There are three ways to work around this issue:
57+
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`.
58+
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`
59+
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.**
60+
4261
## How can I use custom Nix packages or overrides with Devbox?
4362

4463
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.

0 commit comments

Comments
 (0)