diff options
| -rw-r--r-- | modules/by-name/di/direnv/module.nix | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix index ad47a2a7..4a1a4768 100644 --- a/modules/by-name/di/direnv/module.nix +++ b/modules/by-name/di/direnv/module.nix @@ -35,6 +35,8 @@ pkgs.landrun ]; }; + + direnvPkg = lib.getExe direnvCfg.package; in { options.soispha.programs.direnv = { enable = lib.mkEnableOption "direnv"; @@ -44,25 +46,14 @@ in { soispha.programs.fish.integrations.direnv = # fish '' - function __direnv_export_eval - ${lib.getExe direnvCfg.package} export fish | source; - end + set --global SHOULD_SANDBOX_DIRENV - if test -z "$NO_DIRENV_LOAD" - function _direnv_hook - if test -f ".env" -o -f ".envrc" -o -f ".nenvrc" - # ${lib.getExe landrun-fish} --interactive --command='__direnv_export_eval' - __direnv_export_eval - end - end - - function __direnv_on_prompt --on-event fish_prompt; - _direnv_hook - end + function _direnv_export_eval + ${direnvPkg} export fish | source + end - function _direnv_on_preexec --on-event fish_preexec; - _direnv_hook - end + function _direnv_hook --on-event fish_preexec --on-variable PWD + _direnv_export_eval end ''; |
