Feature request: automatically initialise a shell when entering a directory

This issue has been tracked since 2022-12-27.

What are your thoughts on automatically starting a devbox shell when you enter a directory that contains a "devbox.json" file, then closes the shell when you leave that directory? Similar to how https://github.com/cachix/devenv does it?

Lagoja wrote this answer on 2022-12-27

@nbish11 We currently have a direnv integration that can automatically update your path with your Devbox packages.

I think your feature request would make 2 changes to this workflow:

  1. As of 0.2.0, we're installing the packages and adding them to the path, but not activating the full shell. Is the desired behavior to activate the shell, including all plugins + init_hooks?
  2. As of 0.2.0, users have to create the .envrc file themselves. We could add a command to generate it in the repo, or have it created on devbox init.

Thoughts?

nbish11 wrote this answer on 2022-12-27

Thanks for the quick response. I think the second option, where devbox can generate an envrc file, makes sense. I like the idea of having access to my binaries without having to start a full shell.

Lagoja wrote this answer on 2023-01-09

@nbish11 This PR will automatically generate the .envrc file. We're targeting it for our next 0.2.1 release: #438

nbish11 wrote this answer on 2023-01-10

Cheers! I can't wait to start using it. This will improve my work flow considerably.

mohsenari wrote this answer on 2023-01-10

With the recent PRs merging devbox init will automatically prompt for generating and activating a .envrc file.
To clarify, the generated .envrc file will not initialize a shell because there are complications with that (you can try for yourself by modifying the .envrc file).

Right now the file updates the PATH so that when you cd into a directory, the devbox installed packages are in the path. That way, even though you're not in a devbox shell, you can use the packages that are installed in devbox.

We're working on simplifying and improving the way we create the shell environment. Once finished, we'll update the generated .envrc to create a very similar environment to devbox shell.

nbish11 wrote this answer on 2023-01-10

Sounds good.

Lagoja wrote this answer on 2023-01-24

@nbish11 Closing this issue since the direnv integration is now part of 0.2.2. Please let us know if you have any additional requests around this!

More Details About Repo
Owner Name jetpack-io
Repo Name devbox
Full Name jetpack-io/devbox
Language Go
Created Date 2022-08-18
Updated Date 2023-03-31
Star Count 4960
Watcher Count 19
Fork Count 68
Issue Count 42

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date