$ echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
direnv is a language-agnostic environment switcher
think RVM, nvm, phpenv, …
depends only on Bash
nix-env -i direnv
or
brew install direnv
or apt-get install direnv
or fetch binaries on http://direnv.net
$ echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
(or equivalent for zsh, fish, tcsh, …)
.envrc
:~/.config/direnv/direnvrc
(or ~/.direnvrc
)
.envrc
file
…
helpers for common patterns
.envrc
files are checked against the authorization listdirenv allow
or direnv edit
+ save to authorize executionAdding software dependencies
use_nix() {
direnv_load nix-shell --show-trace "$@" --run 'direnv dump'
if [[ $# = 0 ]]; then
watch_file default.nix
watch_file shell.nix
fi
}
nix-profile() {
local profile=$PWD/.direnv/nix-profile
mkdir -p .direnv
nix-env --show-trace -p "$profile" -iAr "$@"
load_prefix "$profile"
}
Thanks for listening!
Time to get the laptops out and hack away
/