-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
144 lines (117 loc) · 3.68 KB
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#! /usr/bin/env bash
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
#####################
### Options etc. ###
#####################
# Force cmdline password entry for ssh and git
unset SSH_ASKPASS
unset GIT_ASKPASS
umask 022
#########################
### Environment Setup ###
#########################
export GDK_BACKEND=wayland,x11
export XDG_CONFIG_HOME="$HOME/.config"
#----------------------------------------#
# Source secrets as env vars, if present #
#----------------------------------------#
if [ -f $DIR/secrets.json ] || [ -L $DIR/secrets.json ]; then
# echo "Secrets file exists."
while IFS= read -r line; do
if [[ $line == "{" || $line == "}" ]]; then
continue
fi
key=$(echo $line | cut -d':' -f1 | tr -d '"' | tr -d ' ')
value=$(echo $line | cut -d':' -f2- | tr -d '"' | tr -d "," | tr -d ' ')
export $key=$value
done <$DIR/secrets.json
else
# echo "No secrets file found."
:
fi
#-----------------------------------#
# Conda / Mamba checks and settings #
#-----------------------------------#
# ...
#------------------------#
# Python/Poetry settings #
#------------------------#
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
export POETRY_HOME=/opt/poetry
if [ -d /opt/poetry/bin ]; then
export PATH=/opt/poetry/bin:$PATH
poetry config virtualenvs.in-project true
fi
unset VIRTUAL_ENV
unset VIRTUAL_ENV_PROMPT
#----------------#
# pyenv settings #
#----------------#
if [ -d ~/dev/.pyenv ]; then
export PYENV_ROOT=~/dev/.pyenv
export PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
pyenv init - | source
fi
####################################
### Custom Aliases and Functions ###
####################################
for file in $DIR/scripts/*.sh; do
source $file
done
####################################
### Additional Configs and Paths ###
####################################
if command -v direnv &>/dev/null; then
eval "$(direnv hook bash)"
fi
if command -v starship &>/dev/null; then
eval "$(starship init bash)"
fi
# if [ -f ~/.cargo/bin ]; then
if [ -d ~/.cargo/bin ]; then
export PATH="$HOME/.cargo/bin:$PATH"
. "$HOME/.cargo/env"
fi
export BUN_INSTALL="$HOME/.bun/"
if [ -d $BUN_INSTALL ]; then
export PATH="$BUN_INSTALL/bin:$PATH"
fi
########################################################################################
unset DIR
####################
### Boring stuff ###
####################
###
### This section may not be necessary, as most of it already exists
### in the default .bashrc file. I'm keeping it here for reference for now.
###
# # If not running interactively, don't do anything
# case $- in
# *i*) ;;
# *) return ;;
# esac
# # No duplicate lines or lines starting with space in history. See bash(1) for more options
# HISTCONTROL=ignoreboth
# # Set history length. See HISTSIZE and HISTFILESIZE in bash(1)
# HISTSIZE=1000
# HISTFILESIZE=2000
# # Make less more friendly for non-text input files, see lesspipe(1)
# [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# # Enable color support of ls and also add handy aliases
# if [ -x /usr/bin/dircolors ]; then
# test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
# alias dir='dir --color=auto'
# alias vdir='vdir --color=auto'
# fi
# # Colored GCC warnings and errors
# export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# # Enable programmable completion features
# # (you don't need to enable this, if it's already enabled
# # in /etc/bash.bashrc, as /etc/profile sources /etc/bash.bashrc).
# if ! shopt -oq posix; then
# if [ -f /usr/share/bash-completion/bash_completion ]; then
# . /usr/share/bash-completion/bash_completion
# elif [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
# fi
# fi