DIRENV.TOML(1)
π NAME
direnv.toml β bestie, it's literally the direnv configuration file π
β¨ DESCRIPTION
Okay so listen: this is a config file, written in TOML format, and it's where you tell direnv all your little preferences. The TOML spec lives over at https://github.com/toml-lang/toml if you wanna go read it (slay).
direnv reads this file from $XDG_CONFIG_HOME/direnv/direnv.toml β which for basically everyone is ~/.config/direnv/direnv.toml.
π¨ Old-school girlies, this one's for you: on versions v2.21.0 and below, useconfig.tomlinstead ofdirenv.toml. Notdirenv.toml. Periodt.
πΈ FORMAT
Wanna know the syntax? The TOML GitHub Repository at https://github.com/toml-lang/toml has all the deets on how the config file is written. Go be nosy, it's fine π¦
π CONFIG
So the config is split into sections, and each section gets its own top-level tables (yeah, the table thing β https://github.com/toml-lang/toml#table), with key/value pairs living inside each section.
Example, because we love a visual:
[section]
key = "value"
These are the sections that are supported, no cap:
π [global]
bash_pathβ lets you hard-code exactly where bash is. Lowkey useful when you wanna stop direnv from absolutely falling apart the momentPATHgets mutated πdisable_stdinβ set it totrueand stdin gets disabled (redirected to/dev/null) while the.envrcis being evaluated.load_dotenvβ requires direnv >= 2.31.0. Set it totrueand direnv will also look for and load.envfiles on top of the.envrcfiles. And if both a.envrcand a.envexist? The.envrcis always chosen first, no debate β¨strict_envβ set it totrueand the.envrcgets loaded withset -euo pipefail. Also bestie, heads up: this option is gonna be the default in the future. Future-proofing, we love to see it.warn_timeoutβ how long to wait before direnv warns you that your command is taking way too long to execute. Defaults to"5s". A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as"300ms","-1.5h"or"2h45m". Valid time units are"ns","us"(or"Β΅s"),"ms","s","m","h". This feature is disabled if the duration is lower or equal to zero. And it will be overwritten if the environment variableDIRENV_WARN_TIMEOUTis set to any of the above values. So like, the env var wins, always.hide_env_diffβ set totrueto hide the diff of the environment variables when loading the.envrc. Defaults tofalse.log_formatβ sets the log format for direnv outputs. Set it to"-"to disable normal logging entirely. Requires direnv >= 2.36.0.log_filterβ a Regexp that you can use to filter out some of the logs. Requires direnv >= 2.36.0.
π‘οΈ [whitelist]
Bestie. Sit down. π«Ά Specifying whitelist directives marks specific directory hierarchies or specific directories as "trusted" β meaning direnv will evaluate any matching .envrc files regardless of whether they've actually been allowed.
π This feature should be used with great care, because anyone with the ability to write files to that directory (yes, including collaborators on VCS repositories) will be able to execute arbitrary code on your computer. Like. Anyone. Any code. Be so serious about this one.
There are two types of whitelist directives supported:
prefixβ accepts an array of strings. If any of the strings in this list are a prefix of an.envrcfile's absolute path, that file will be implicitly allowed, regardless of contents or past usage ofdirenv allowordirenv deny.
Example:
[whitelist]
prefix = [ "/home/user/code/project-a", "~/code/project-b" ]
In this example, the following .envrc files will be implicitly allowed:
/home/user/code/project-a/.envrc/home/user/code/project-a/subdir/.envrc~/code/project-b/.envrc~/code/project-b/subdir/.envrc- and so on
In this example, the following .envrc files will not be implicitly allowed (although they can be explicitly allowed by running direnv allow):
/home/user/project-c/.envrc/opt/random/.envrc
exactβ accepts an array of strings. Each string can be a directory name or the full path to an.envrcfile. If a directory name is passed, it will be treated as if it had been passed as itself with/.envrcappended. After resolving the filename, each string will be checked for being an exact match with an.envrcfile's absolute path. If they match exactly, that.envrcfile will be implicitly allowed, regardless of contents or past usage ofdirenv allowordirenv deny.
Example:
[whitelist]
exact = [ "/home/user/project-a/.envrc", "~/project-b/subdir-a" ]
In this example, the following .envrc files will be implicitly allowed, and no others:
/home/user/code/project-a/.envrc~/project-b/subdir-a
In this example, the following .envrc files will not be implicitly allowed (although they can be explicitly allowed by running direnv allow):
/home/user/code/project-b/subproject-c/.envrc~/code/.envrc
π COPYRIGHT
MIT licence - Copyright (C) 2019 @zimbatm and contributors
π SEE ALSO
And that's the whole page, bestie π this was direnv.toml, from the direnv manual set, dated 2019. Go forth and configure responsibly β especially that whitelist section, I'm watching you πβ¨
π¦ where this page comes from
- alpine 3.24: direnv-doc 2.37.1-r9 Β· MIT
- arch rolling: direnv 2.38.2-1 Β· MIT
- fedora 44: direnv 2.37.1-6.fc44 Β· BSD-3-Clause AND MIT
- nixos 26.05: direnv 2.37.1
- nixpkgs unstable: direnv 2.38.2
- ubuntu resolute: direnv 2.37.1-1 Β· MIT
- ubuntu stonking: direnv 2.37.1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms