Skip to content

[docs] Updated direnv docs to reflect update after v0.5.0 #1080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 2, 2023
Merged
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
21 changes: 16 additions & 5 deletions docs/app/docs/ide_configuration/direnv.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ If you see any errors when activating your `.envrc` file, you will need to run `

#### New Project

If you have direnv installed, Devbox will generate an .envrc file when you run `devbox init` and enables it by running `direnv allow` in the background:
If you have direnv installed, Devbox will generate an .envrc file when you run `devbox generate direnv` and enables it by running `direnv allow` in the background:

```bash
➜ devbox init
➜ devbox generate direnv
Success: generated .envrc file
Success: ran `direnv allow`
direnv: loading ~/src/devbox/docs/.envrc
direnv: using devbox
```

This will generate a `.envrc` file in your root directory along with your `devbox.json`, you can run `direnv allow` so that your shell will activate whenever you navigate to the directory
or `direnv revoke` to stop.
This will generate a `.envrc` file in your project directory that contains `devbox.json`. Run `direnv allow` to activate your shell upon directory navigation. Run `direnv revoke` to stop. Changes to `devbox.json` automatically trigger direnv to reset the environment.


#### Existing Project
Expand All @@ -38,6 +39,8 @@ For an existing project, you can add a `.envrc` file by running `devbox generate

```bash
➜ devbox generate direnv
Success: generated .envrc file
Success: ran `direnv allow`
direnv: loading ~/src/devbox/docs/.envrc
direnv: using devbox
```
Expand All @@ -53,6 +56,14 @@ Alternatively, a project directory can be whitelisted so that changes will be au
prefix = [ "/absolute/path/to/project" ]

```
<!-- TODO: add steps for vscode integration -->

### VSCode setup with direnv

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

1. Open a terminal window and activate direnv with `direnv allow`.
2. Launch VSCode from the same terminal window using the command `code .` This ensures that VSCode inherits the direnv environment.

Alternatively, you can use the [direnv VSCode extension](https://marketplace.visualstudio.com/items?itemName=mkhl.direnv) if your VSCode workspace has a .envrc file.

If this guide is missing something, feel free to contribute by opening a [pull request](https://github.com/jetpack-io/devbox/pulls) in Github.