diff options
Diffstat (limited to 'modules/by-name')
| -rw-r--r-- | modules/by-name/di/direnv/module.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix index 9c2975c3..fc800f35 100644 --- a/modules/by-name/di/direnv/module.nix +++ b/modules/by-name/di/direnv/module.nix @@ -52,10 +52,19 @@ in { ${direnvPkg} export fish | source end - function _direnv_hook --on-event fish_preexec --on-variable PWD - if not set --query IN_DIRENV_SANDBOX; and set --query SHOULD_SANDBOX_DIRENV; and ${direnvPkg} status | grep 'Found RC path' --invert-match | grep 'No .envrc or .env loaded' --quiet - # We found a rc path, but none are loaded. So we can start our shell. - ${lib.getExe landrun-fish} --interactive --command='_direnv_export_eval' + function _direnv_hook --on-variable PWD + if not set --query IN_DIRENV_SANDBOX; + and set --query SHOULD_SANDBOX_DIRENV; + and ${direnvPkg} status | grep 'Found RC path' --quiet; + and ${direnvPkg} status | grep 'No .envrc or .env loaded' --quiet + + # We found a RC path, but no RC file is loaded. So we can start our shell and + # load it. + ${lib.getExe landrun-fish} --init-command='_direnv_export_eval' + + # After the user exists (via Ctrl+D), they probably want to change the + # directory. + ll else _direnv_export_eval end |
