direnv: Use ${getExe pkg} instead of ${pkg}/bin/pkg

This commit is contained in:
Joaquín Triñanes 2023-12-18 03:02:00 +01:00 committed by Robert Helgesson
parent 67c4c05c29
commit bc52cdd579
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -114,18 +114,18 @@ in {
# Using mkAfter to make it more likely to appear after other
# manipulations of the prompt.
mkAfter ''
eval "$(${cfg.package}/bin/direnv hook bash)"
eval "$(${getExe cfg.package} hook bash)"
'');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/direnv hook zsh)"
eval "$(${getExe cfg.package} hook zsh)"
'';
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration (
# Using mkAfter to make it more likely to appear after other
# manipulations of the prompt.
mkAfter ''
${cfg.package}/bin/direnv hook fish | source
${getExe cfg.package} hook fish | source
'');
programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration (
@ -135,7 +135,9 @@ in {
$env.config = ($env.config? | default {})
$env.config.hooks = ($env.config.hooks? | default {})
$env.config.hooks.pre_prompt = ($env.config.hooks.pre_prompt? | default [] | append {||
let direnv = (${cfg.package}/bin/direnv export json | from json | default {})
let direnv = (${
getExe cfg.package
} export json | from json | default {})
if ($direnv | is-empty) {
return
}