diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 1dd772ff3174..efd1abbe02a9 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -4,11 +4,12 @@ # environment variables) and from shell scripts (as functions). runHook() { local hookName="$1" - if test "$(type -t $hookName)" = function; then - $hookName - else - eval "${!hookName}" - fi + case "$(type -t $hookName)" in + (function|alias|builtin) $hookName;; + (file) source $hookName;; + (keyword) :;; + (*) eval "${!hookName}";; + esac }