Skip to content

Commit f4a8c74

Browse files
authored
Update Docs: direnv, gen readme, FAQs (#1751)
## Summary * Adds two FAQs around pinning Devbox Version, and handling libstdc++ libraries * Updates Direnv docs to explain 2 limitations around aliases/functions and modifying $PS1 * Updated Installation instructions to cover updating and pinning the version * Adds docs for `devbox generate readme` ## How was it tested? Localhost
1 parent 2fee55b commit f4a8c74

File tree

6 files changed

+101
-4
lines changed

6 files changed

+101
-4
lines changed

docs/app/docs/cli_reference/devbox_generate.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# devbox generate
22

3-
Top level command for generating Devcontainer and Dockerfiles for your Devbox Project.
3+
Top level command for generating Devcontainers, Dockerfiles, and other useful files for your Devbox Project.
44

55
```bash
66
devbox generate <devcontainer|dockerfile|direnv> [flags]
@@ -18,8 +18,9 @@ devbox generate <devcontainer|dockerfile|direnv> [flags]
1818
## Subcommands
1919

2020
* [devbox generate devcontainer](devbox_generate_devcontainer.md) - Generate Dockerfile and devcontainer.json files under .devcontainer/ directory
21-
* [devbox generate dockerfile](devbox_generate_dockerfile.md) - Generate a Dockerfile that replicates devbox shell
2221
* [devbox generate direnv](devbox_generate_direnv.md) - Generate a .envrc file to use with direnv
22+
* [devbox generate dockerfile](devbox_generate_dockerfile.md) - Generate a Dockerfile that replicates devbox shell
23+
* [devbox generate readme](devbox_generate_dockerfile.md) - Generate markdown readme file for your project
2324

2425
## SEE ALSO
2526

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# devbox generate readme
2+
3+
Generate a markdown readme file for this project. You must specify a name for the Readme file when running the command:
4+
5+
```bash
6+
devbox generate readme [filename] [flags]
7+
```
8+
9+
## Options
10+
11+
<!-- Markdown Table of Options -->
12+
| Option | Description |
13+
| --- | --- |
14+
| `-c, --config string` | path to directory containing a devbox.json config file |
15+
| `-h, --help` | help for dockerfile |
16+
| `-q, --quiet` | Quiet mode: Suppresses logs. |
17+
18+
19+
## SEE ALSO
20+
21+
* [devbox generate](devbox_generate.md) -
22+

docs/app/docs/devbox_examples/languages/python.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This will install Python 3.10 in your shell. You can find other versions of Pyth
2929

3030
The `python` package automatically comes bundled with `pip`, and the `python` plugin for Devbox will automatically create a virtual environment for installing your packages locally
3131

32-
Your virtual environment is created in the `.devbox/virtenv/python` directory by default, and can be activated by running `. $VENV_DIR/bin/activate` in your devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`:
32+
Your virtual environment is created in the `.devbox/virtenv/python` directory by default, and can be activated by running `. $VENV_DIR/bin/activate` in your Devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`:
3333

3434
```json
3535
{
@@ -42,6 +42,29 @@ Your virtual environment is created in the `.devbox/virtenv/python` directory by
4242
}
4343
```
4444

45+
:::info
46+
47+
For Fish or other shells, you may need to use a different activation script. See the [venv docs](https://docs.python.org/3/library/venv.html#how-venvs-work) for more details.
48+
49+
:::
50+
51+
Devbox installs the virtual environment in `.devbox/virtenv/python/.venv` by default. You can modify this path by setting the `VENV_DIR` environment variable in your devbox.json:
52+
53+
```json
54+
{
55+
"packages": [
56+
57+
],
58+
"env": {
59+
// Install your virtual environment in `.venv`
60+
"VENV_DIR": ".venv"
61+
},
62+
"shell": {
63+
"init_hook": ". $VENV_DIR/bin/activate"
64+
}
65+
}
66+
```
67+
4568
If you need to install a specific version of Pip, you can run `devbox add python3xxPackages.pip`, where `3xx` is the major + minor version (e.g., python310 = [email protected]) of Python you want to install:
4669

4770
```json

docs/app/docs/faq.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,29 @@ In order to save space, Devbox and Nix only install the required components of p
3535

3636
You can learn more about non-default outputs [here](./guides/using_flakes.md#installing-additional-outputs-from-a-flake).
3737

38+
## I'm trying to build a project, but it says that I'm missing `libstdc++`. How do I install this library in my project?
39+
40+
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`.
41+
3842
## How can I use custom Nix packages or overrides with Devbox?
3943

4044
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.
4145

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

44-
Yes. In addition to supporting POSIX compliant shells like Zsh and Bash, Devbox also works with Fish.
48+
Yes. In addition to supporting POSIX compliant shells like Zsh and Bash, Devbox also works with Fish.
49+
50+
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.
51+
52+
## How can I rollback to a previous version of Devbox?
53+
54+
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:
55+
56+
```bash
57+
export DEVBOX_USE_VERSION=0.8.0
58+
```
59+
60+
You can upgrade to the latest version of Devbox by unsetting the variable, and running `devbox version update`
4561

4662
## How can I uninstall Devbox?
4763

docs/app/docs/ide_configuration/direnv.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ prefix = [ "/absolute/path/to/project" ]
103103

104104
```
105105

106+
### Direnv Limitations
107+
108+
Direnv works by creating a sub-shell using your `.envrc` file, your `devbox.json`, and other direnv related files, and then exporting the diff in environment variables into your current shell. This imposes some limitations on what it can load into your shell:
109+
110+
1. Direnv cannot load shell aliases or shell functions that are sourced in your project's `init_hook`. If you want to use direnv and also configure custom aliases, we recommend using [Devbox Scripts](../guides/scripts.md).
111+
2. Direnv does not allow modifications to the $PS1 environment variable. This means `init_hooks` that modify your prompt will not work as expected. For more information, see the [direnv wiki](https://github.com/direnv/direnv/wiki/PS1)
112+
113+
Note that sourcing aliases, functions, and `$PS1` should work as expected when using `devbox shell`, `devbox run`, and `devbox services`
114+
106115
### VSCode setup with direnv
107116

108117
To seamlessly integrate VSCode with a direnv environment, follow these steps:

docs/app/docs/installing_devbox.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,35 @@ To install on a non NixOS:
8585
nix-env -iA nixpkgs.devbox
8686
```
8787

88+
or
89+
90+
```bash
91+
nix profile install nixpkgs#devbox
92+
```
93+
8894
</TabItem>
8995
</Tabs>
9096

97+
## Updating Devbox
98+
99+
Devbox will notify you when a new version is available. To update to the latest released version of Devbox, you can run `devbox version update`.
100+
101+
If you installed Devbox with Nix, you can update Devbox via Nix using `nix-env -u devbox`, or `nix profile upgrade`.
102+
103+
You can find release notes and details on the [Releases page](http://github.com/jetpack-io/devbox/releases) of the Devbox Github repo.
104+
105+
## Rolling Back or Pinning a Specific Version of Devbox
106+
107+
You can rollback or pin the version of Devbox on your system using the `DEVBOX_USE_VERSION` environment variable. For example, to use version 0.8.0:
108+
109+
```bash
110+
export DEVBOX_USE_VERSION=0.8.0
111+
```
112+
113+
Setting this variable will use the specified version of Devbox even if a newer version has been installed on your machine.
114+
115+
If you installed Devbox with Nixpkgs, you will need to pin Devbox in your profile or Nix configuration. You can find the Nixpkg commits for previous versions of Devbox on [Nixhub](https://www.nixhub.io/packages/devbox).
116+
91117
## Next Steps
92118

93119
* **[Getting Started](quickstart.mdx):** Learn how to create a dev environment with Devbox

0 commit comments

Comments
 (0)