#!env bash
pushd ~

sudo apt-get update
sudo apt-get install vim tmux git fluxbox aptitude default-jdk default-jdk-doc fontconfig apt-file thefuck libxft-dev
sudo apt-file update
mkdir ~/projects ~/programs ~/temp
git clone _git@git.jdb-labs.com:jdb/dotfile temp/dotfiles
cd ~/temp/dotfiles
cp -r .fonts .tmux.conf .vimrc .vim .bash_aliases .gitconfig .screenrc .Xdefaults .config .gradle .xinitrc ~
cat .bashrc >> ~/.bashrc

# VIM
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
cd ~/.vim/bundle
git clone https://github.com/ctrlpvim/ctrlp.vim

# Setup ST
git clone http://git.suckless.org/st programs/st
cd ~/programs/st
cp ~/projects/dotfiles/st/* .
cp config.normal.h config.h && make && sudo make install
cp config.large.h config.h && make && sudo cp st /usr/local/bin/st-large
cp config.small.h config.h && make && sudo cp st /usr/local/bin/st-small

# Setup Groovy & Gradle
cd ~/temp
wget https://dl.bintray.com/groovy/maven/apache-groovy-sdk-2.4.6.zip
wget https://services.gradle.org/distributions/gradle-2.12-all.zip
cd ~/programs
unzip ~/temp/apache-groovy-sdk-2.4.5.zip
unzip ~/temp/gradle-2.12-all.zip
rm ~/temp/apache-groovy-sdk-2.4.5.zip
rm ~/temp/gradle-2.12-all.zip
ln -s groovy-2.4.5 groovy
ln -s gradle-2.12 gradle

echo 'export GROOVY_HOME=$HOME/programs/groovy' >> ~/.profile
echo 'export GRADLE_HOME=$HOME/programs/gradle' >> ~/.profile
echo 'export PATH="$PATH:$GROOVY_HOME/bin:$GRADLE_HOME/bin"' >> ~/.profile

# Setup Nim
cd ~/programs
git clone https://github.com/nim-lang/Nim.git nim
cd nim
git clone --depth 1 https://github.com/nim-lang/csources
cd csources && sh build.sh
cd ..
bin/nim c koch
./koch boot -d:release

cd ~/programs
git clone https://github.com/nim-lang/nimble
cd nimble
nim c -r src/nimble install

echo 'export NIM_HOME="$HOME/programs/nim"' >> ~/.profile
echo 'export PATH="$PATH:$NIM_HOME/bin:$HOME/.nimble/bin"' >> ~/.profile

popd
