1
0
Fork 0
mirror of https://gitlab.com/dwt1/dotfiles.git synced 2023-02-13 20:55:19 -05:00
dwt1--dotfiles/.emacs.d/modules/tools/direnv
2020-06-19 22:43:40 -05:00
..
config.el Updating Doom Emacs. 2020-06-19 22:43:40 -05:00
doctor.el Moving to Doom Emacs! 2019-12-16 20:21:19 -06:00
packages.el Updating Doom Emacs. 2020-06-19 22:43:40 -05:00
README.org Updating Doom Emacs. 2020-06-19 22:43:40 -05:00

tools/direnv

Description

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 provides no flags.

Plugins

Hacks

  • Normally, the direnv environment is updated on post-command-hook. We've changed it to update on doom-switch-buffer-hook, doom-switch-window-hook and doom-switch-frame-hook instead.
  • Special direnv keywords/commands are highlighted in direnv-envrc-mode.
  • A fix has been applied to ensure flycheck searches for executables from within the direnv environment, if any.

Prerequisites

This module requires the direnv utility.

MacOS

brew install direnv

Arch Linux

sudo pacman -S direnv

NixOS

environment.systemPackages = [ pkgs.direnv ];

Or nix-env -i direnv

Troubleshooting

direnv + nix is slow

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

services.lorri.enable = true;