diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-26 00:08:12 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-26 00:08:12 +0200 |
| commit | 8c35eb15dbfceeb5651c1c3680c4193e08fa1c73 (patch) | |
| tree | 93057811c44fd3a26392fa3b5cbc4600bc183134 /modules | |
| parent | pkgs/direnv-patched: Run pre* and post* hooks (diff) | |
| download | nixos-config-8c35eb15dbfceeb5651c1c3680c4193e08fa1c73.zip | |
modules/direnv: Correctly express condition for landlock shell spawn
Diffstat (limited to '')
| -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 |
