Remove pyenv and other NixOS tweaks

This commit is contained in:
Ivan Malison 2018-05-30 22:18:15 -07:00
parent 8d9870404d
commit 403643f980
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 23 additions and 43 deletions

View File

@ -14,35 +14,17 @@ function shell_contains () {
return 1 return 1
} }
function _set_python_command {
# See comment in add_to_path about why this is necessary
if command_exists pyenv;
then
_python_command="$(pyenv which python)"
else
which pyenv
_python_command="$(which python)"
fi
shell_contains "$_python_command" "shim" && \
echo "Warning: setting python command to shim"
}
function environment_variable_exists { function environment_variable_exists {
eval "value=\"\${$1+x}\"" eval "value=\"\${$1+x}\""
[ ! -z $value ] [ ! -z $value ]
} }
function setup_unless_environment_variable_exists { function setup_unless_environment_variable_exists {
environment_variable_exists "$1" || $2 environment_variable_exists "$1" || { $2 && export "$1=$(date)"; }
export "$1=$(date)"
} }
function add_to_path { function add_to_path {
environment_variable_exists _python_command || _set_python_command eval "$(python $HOME/.lib/python/shell_path.py --include-assignment "$@")"
# We need to get a path to the ACTUAL python command because
# pyenv alters PATH before actually executing python, which ends
# up changing PATH in a way that is not desireable.
eval "$($_python_command $HOME/.lib/python/shell_path.py --include-assignment "$@")"
} }
# Taken from http://www.unix.com/shell-programming-and-scripting/27932-how-know-linux-distribution-i-am-using.html # Taken from http://www.unix.com/shell-programming-and-scripting/27932-how-know-linux-distribution-i-am-using.html
@ -65,6 +47,11 @@ function get_linux_distro {
[ -n "$dist" ] && echo "$dist" && return 0 [ -n "$dist" ] && echo "$dist" && return 0
fi fi
if [ -r /etc/os-release ]; then
dist=$(grep 'ID=' /etc/os-release | sed 's/ID=//' | head -1)
[ -n "$dist" ] && echo "$dist" && return 0
fi
dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | sed 's/\/etc\///' | sed 's/-release//' | head -1) dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | sed 's/\/etc\///' | sed 's/-release//' | head -1)
[ -n "$dist" ] && echo "$dist" && return 0 [ -n "$dist" ] && echo "$dist" && return 0
@ -75,14 +62,18 @@ function get_linux_distro {
function is_osx() { function is_osx() {
if command_exists uname; then
case `uname` in case `uname` in
'Darwin') 'Darwin')
return 0 return 0;
;; ;;
*) *)
return 1; return 1;
;; ;;
esac esac
else
return 1
fi
} }
function source_directory_files { function source_directory_files {

View File

@ -3,10 +3,6 @@ source "$HOME/.lib/setup_functions.sh"
function _setup_path { function _setup_path {
_path_helper _path_helper
# XXX/TODO:
# This is in shellenv.sh now
_python_setup
add_to_path "$HOME/.lib/bin" "$HOME/.local/bin" "$HOME/bin" --before add_to_path "$HOME/.lib/bin" "$HOME/.local/bin" "$HOME/bin" --before
add_to_path "/usr/local/sbin" "/usr/local/bin" "/usr/bin" --after add_to_path "/usr/local/sbin" "/usr/local/bin" "/usr/bin" --after
_ruby_setup _ruby_setup
@ -16,6 +12,7 @@ function _setup_path {
_haskell_setup _haskell_setup
_java_setup _java_setup
_go_setup _go_setup
_python_setup
_racket_setup _racket_setup
_rust_setup _rust_setup
_tex_setup _tex_setup
@ -49,17 +46,7 @@ function _osx_path_setup {
} }
function _python_setup { function _python_setup {
export PYENV_ROOT="/usr/local/var/pyenv"
if which pyenv > /dev/null; then
eval "$(pyenv init - --no-rehash)"
else
echo "WARNING: pyenv is not installed on this machine and python will likely not function correctly"
fi
add_to_path "$HOME/.lib/python" --after add_to_path "$HOME/.lib/python" --after
# if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
add_to_path "$HOME/.lib/python" --path-var 'PYTHONPATH' add_to_path "$HOME/.lib/python" --path-var 'PYTHONPATH'
} }

View File

@ -1,7 +1,9 @@
# -*- mode: sh; -*- # -*- mode: sh; -*-
# If there are issues with path, check /etc/profile for hard overrides of PATH. # If there are issues with path, check /etc/profile for hard overrides of PATH.
source "$HOME/.lib/login.sh" . "$HOME/.lib/login.sh"
# XXX: prevents https://github.com/xmonad/xmonad/issues/86 from affecting startup # XXX: prevents https://github.com/xmonad/xmonad/issues/86 from affecting startup
rm -f ~/.xmonad/xmonad.state rm -f ~/.xmonad/xmonad.state
load_xkb_map.sh load_xkb_map.sh