đź“ťHow-to: nix-shell with direnv

tags

#how-to Nix

source

Some direnv best practices. Actually just one. - DEV Community

Direnv script should not block. Separate nix-shell building and setting direnv variables.

Build environment:

#!/usr/bin/env bash
nix-shell --run \
  'unset ${!SSH_@} ${!DIRENV_@} && direnv dump > .envrc.cache'

(SSH_ and DIRENV_ variables might lead to troubles if cached)

source <(direnv apply_dump .envrc.cache)

Another option: target/lorri: Your project’s nix-env

Backlinks

  • đź“ť Nix