doomemacs/modules/tools/direnv
Henrik Lissner 1abcf913aa
revert: fix(docs): set mode in file-local vars
emacs-straight/org-mode@e22b4eb7aa introduced a breaking change that
made it impossible to rely on .dir-locals.el to change org-mode buffers
in $EMACSDIR to doom-docs-org-mode (without infinite recursion), so we
used file-local variables in 7e400ab.

emacs-straight/org-mode@215de6176b reverted that change, so we can use
.dir-locals.el again, and this is my preference, since it requires less
boilerplate across our hundreds of org files.

Ref: emacs-straight/org-mode@215de6176b
Ref: emacs-straight/org-mode@e22b4eb7aa
Revert: 7e400abdc0
2022-08-07 19:08:07 +02:00
..
config.el tools/direnv: refactor 2021-07-06 02:32:38 -04:00
doctor.el Add tools/direnv module 2019-04-05 03:16:37 -04:00
packages.el bump: :tools 2022-06-17 21:53:56 +02:00
README.org revert: fix(docs): set mode in file-local vars 2022-08-07 19:08:07 +02:00

:tools direnv

Description   unfold

This module integrates direnv into Emacs.

📌 direnv is an environment switcher for the shell. It knows how to hook into bash, zsh, tcsh, fish shell and elvish to load or unload environment variables depending on the current directory. This allows project-specific environment variables without cluttering the ~/.profile file.

Before each prompt, direnv checks for the existence of a ".envrc" file in the current and parent directories. If the file exists (and is authorized), it is loaded into a bash sub-shell and all exported variables are then captured by direnv and then made available to the current shell.

Module flags

This module has no flags.

Packages

Hacks

  • envrc-mode has been modified to fail gracefully if direnv isn't available.
  • envrc-global-mode has been modified to activate envrc-mode sooner in the major mode activation process, so that any env state performed in mode hooks aren't overwritten by direnv.
  • Added direnv support for Org src blocks.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires direnv.

MacOS

brew install direnv

Arch Linux

direnv is available on the AUR:

yay -S direnv

NixOS

environment.systemPackages = [ pkgs.direnv ];

Or $ nix-env -i direnv

TODO Usage

🔨 This module's usage documentation is incomplete. Complete it?

To make use of direnv you need a .envrc file in a directory. Any time you open a file or buffer in said directory, the envrc Emacs package will kick in, activate the local env, and inject it into Emacs for the current buffer.

TODO Configuration

🔨 This module has no configuration documentation yet. Write some?

Troubleshooting

Report an issue?

direnv + nix is slow

Consider augmenting direnv with lorri, which will cache nix builds and speed up direnv tremendously:

services.lorri.enable = true;

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

🔨 This module has no appendix yet. Write one?