toolbox-direnv#
A wrapper around Toolbx to provide commands which exist in a dev container, in the host transparently.
This project is a fork of box-direnv, that was heavily inspired by nix-direnv.
It should technically work inside Flatpak editors (tested VSCodium with the direnv extension) if you're willing to make a couple of holes in the sandbox (specifically, path to direnv, direnvrc and anything in between that's not standard direnv but your own configuration).
Installation#
Put the following lines in your direnvrc:
if ! has toolbox_direnv_version || ! toolbox_direnv_version 0.1.0; then
source_url "https://tangled.org/072004.xyz/toolbox-direnv/raw/d2d5798f2c67923408d7a00dc1d8fbc2407e1f20/toolbox.sh" \
"sha256-/LlcC7ys6V+00Q4J2h1xB2ghImcj4tHyjFzKkT9CH7o="
fi
Usage#
Ignoring container commands#
If you wish to ignore a container command
(ie. to use host's git instead), you may use TOOLBOX_DIRENV_CMD_IGNORELIST:
# before sourcing:
TOOLBOX_DIRENV_CMD_IGNORELIST=(podman flatpak git nano)
# rest of direnvrc...
From a local .toolbox/Containerfile#
You may wish to customize your container image before entering the environment. In this case, you can tell toolbox-direnv to use a local build context directly.
use toolbox
# or name your container instead of using $PWD
use toolbox my-awesome-project
# not standard Containerfile location/filename
use toolbox ./docker/Dockerfile
use toolbox my-awesome-project ./docker/Dockerfile
From image registry#
Add the line use toolbox <image> to tell toolbox-direnv to create
a container from that image. For example:
use toolbox registry.fedoraproject.org/fedora-toolbox:43
# or name your container instead of using $PWD
use toolbox my-awesome-project registry.fedoraproject.org/fedora-toolbox:43