nix-shell: Execute shellHook if it exists

Since normal builds don't execute shellHook, this allows nix-shell
specific customisation.  Suggested by Domen.
This commit is contained in:
Eelco Dolstra 2014-02-17 13:34:24 +01:00
parent 832377bbd6
commit e81d38c02b
2 changed files with 17 additions and 0 deletions

View file

@ -207,6 +207,7 @@ foreach my $expr (@exprs) {
($pure ? '' : 'p=$PATH; ' ) .
'dontAddDisableDepTrack=1; ' .
'[ -e $stdenv/setup ] && source $stdenv/setup; ' .
'if [ "$(type -t runHook)" = function ]; then runHook shellHook; fi; ' .
($pure ? '' : 'PATH=$PATH:$p; unset p; ') .
'set +e; ' .
'[ -n "$PS1" ] && PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' .