Jonas Pfenniger Chevalier IRL
zimbatm everywhere else: twitter, github, …
brew install direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
exec bash
supports bash, zsh, fish, tcsh and more
packages for homebrew, debian, archlinux and nixos. or just grab the binary.
hook into shell
eval "direnv export <shell>"
executed before every prompt
load .envrc
in bash if found, export diff
injected into the bash .envrc
context
-
PATH_add
-
load_prefix
-
dotenv
-
source_env / source_up
-
layout
-
use
-
…
man direnv-stdlib
direnv stdlib | less
ruby-install ruby 1.9.3
~/.direnvrc
use_ruby() {
load_prefix "$HOME/.rubies/ruby-$1"
}
.envrc
use ruby 1.9.3-p551
~/.direnvrc
use_ruby() {
load_prefix "$HOME/.rubies/$1"
layout ruby
}
ruby-version() {
use ruby ruby-"$(< .ruby-version)"
}
.envrc
ruby-version
dotenv
How to avoid having .direnv/
listed in git
$ git config core.excludesfile ~/.gitignore_global