Skip to content

Commit

Permalink
Some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Feb 1, 2024
1 parent a23aa12 commit 8852a7a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
42 changes: 42 additions & 0 deletions config/files/usr/bin/distrobox-user
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -oue pipefail

# Run setup
echo 'Running initial setup...'

# Install oh-my-zsh
ZSH="$XDG_CONFIG_HOME/oh-my-zsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Spaceship theme
ZSH_CUSTOM="$XDG_CONFIG_HOME/oh-my-zsh/custom"
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
sed -i 's/^ZSH_THEME="robbyrussell"/ZSH_THEME="spaceship"/' "$XDG_CONFIG_HOME/.zshrc"

# nvm
nvm_setup='[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'

echo "$nvm_setup" >> "$XDG_CONFIG_HOME/.zshrc"

git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
\. "$NVM_DIR/nvm.sh"

nvm install 8 ; nvm install 12
nvm install 14 ; npm install -g npm@7
nvm install 18 ; nvm alias default 18

# pyenv
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
git clone https://github.com/pyenv/pyenv-virtualenv.git "$PYENV_ROOT/plugins/pyenv-virtualenv"

echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> "$XDG_CONFIG_HOME/.zshrc"
echo 'eval "$(pyenv init -)"' >> "$XDG_CONFIG_HOME/.zshrc"

"$PYENV_ROOT/bin/pyenv" install 3.10.13; "$PYENV_ROOT/bin/pyenv" install 2.7.18
"$PYENV_ROOT/bin/pyenv" virtualenv 2.7.18 local2
"$PYENV_ROOT/bin/pyenv" global 3.10.13 local2

37 changes: 2 additions & 35 deletions config/files/usr/etc/skel/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,18 @@
if [ -n "$CONTAINER_ID" ]; then
# Inside of a distrobox container
export XDG_CONFIG_HOME="$HOME/.config/contexts/$CONTAINER_ID"
export ZDOTDIR="$HOME/.config/contexts/$CONTAINER_ID"
export NVM_DIR="$HOME/.config/contexts/$CONTAINER_ID/.nvm"
export PYENV_ROOT="$HOME/.config/contexts/$CONTAINER_ID/.pyenv"

SETUP_DONE="$XDG_CONFIG_HOME/setup-done"

if ! [ -f "$SETUP_DONE" ]; then
# Run setup
echo 'Running initial setup...'

# Install oh-my-zsh
ZSH="$ZDOTDIR/oh-my-zsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Spaceship theme
ZSH_CUSTOM="$ZDOTDIR/oh-my-zsh/custom"
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

# nvm
nvm_setup='[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'

echo "$nvm_setup" >> "$ZDOTDIR/.zshrc"

git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
"$NVM_DIR/nvm.sh"
nvm install 8 ; nvm install 12
nvm install 14 ; npm install -g npm@7
nvm install 18 ; npm install -g npm@9 ; nvm alias default 18

# pyenv
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"

echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> "$ZDOTDIR/.zshrc"
echo 'eval "$(pyenv init -)"' >> "$ZDOTDIR/.zshrc"

PATH="$PYENV_ROOT/bin:$PATH" pyenv init -
PATH="$PYENV_ROOT/bin:$PATH" pyenv install 3.10.13; pyenv install 2.7.18
PATH="$PYENV_ROOT/bin:$PATH" pyenv virtualenv 2.7.18 local2
PATH="$PYENV_ROOT/bin:$PATH" pyenv global 3.10.13 local2
/usr/bin/distrobox-user

echo 1 > "$SETUP_DONE"
fi

source "$ZDOTDIR/.zshrc"
source "$XDG_CONFIG_HOME/.zshrc"
unset SETUP_DONE
else
# localhost
Expand Down

0 comments on commit 8852a7a

Please sign in to comment.