Added nix-shell plugin to oh-my-zsh
This commit is contained in:
parent
70e0c63886
commit
7712beeeb4
5 changed files with 249 additions and 0 deletions
26
pkgs/zsh/plugins/nix-shell/scripts/buildShellShim
Executable file
26
pkgs/zsh/plugins/nix-shell/scripts/buildShellShim
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
if [ "$1" = "--rcfile" ]; then
|
||||
# This means the shell should stay open after executing. So we remove the last line which contains 'exit'
|
||||
shift
|
||||
tmp="$(cat $1)"
|
||||
echo ${tmp%exit} > $1
|
||||
cat >> $1 <<EOF
|
||||
SHELL=$NIX_EXECUTING_SHELL
|
||||
unset NIX_BUILD_SHELL
|
||||
FPATH=\$(echo 'echo \$FPATH' | $NIX_EXECUTING_SHELL --stdin)
|
||||
for path in \${PATH//:/ }; do
|
||||
if [[ \$path = /nix/store/* ]]; then
|
||||
path=\${path/%bin/share\/zsh\/site-functions}
|
||||
if [ -d "\$path" ]; then
|
||||
FPATH="\$path:\$FPATH"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
FPATH=\$FPATH $NIX_EXECUTING_SHELL
|
||||
EOF
|
||||
/usr/bin/env bash $1
|
||||
else
|
||||
/usr/bin/env bash "$@"
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue