Skip to content

Instantly share code, notes, and snippets.

@geggo98
Last active March 22, 2016 17:15
Show Gist options
  • Save geggo98/8221245f6cfb9f1fa1c7 to your computer and use it in GitHub Desktop.
Save geggo98/8221245f6cfb9f1fa1c7 to your computer and use it in GitHub Desktop.
Vagrantfile for Scala
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "boxcutter/ubuntu1510"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "apt", type: "shell", privileged: false, inline: <<-SHELL
echo Initialize package cache with the newest version on the internet
export DEBIAN_FRONTEND=noninteractive
sudo perl -pi -e '$_ = "# $_"' /etc/apt/sources.list
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt $(lsb_release -c -s) main restricted universe multiverse" | sudo tee --append /etc/apt/sources.list
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt $(lsb_release -c -s)-updates main restricted universe multiverse" | sudo tee --append /etc/apt/sources.list
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt $(lsb_release -c -s)-security main restricted universe multiverse" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y software-properties-common debconf-utils
SHELL
config.vm.provision "openjdk", type:"shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y openjdk-8-jdk openjdk-8-source
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
java -version
SHELL
config.vm.provision "oracle-jdk", type:"shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
echo Install ORacle Java 8...
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
echo 'oracle-java8-installer shared/accepted-oracle-license-v1-1 boolean true' | sudo debconf-set-selections
sudo apt-get -y install oracle-java8-installer
sudo apt-get -y install oracle-java8-unlimited-jce-policy
java -version
SHELL
config.vm.provision "scala", type:"shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
echo 'Install SBT, Graphviz (for scaladoc) and Node.js (for Play framework)'
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install -y sbt graphviz nodejs
wget -q http://downloads.lightbend.com/scala/2.11.8/scala-2.11.8.deb
sudo dpkg --install scala-2.11.8.deb
sudo ln -sf /bin/readlink /usr/bin/greadlink
sbt about
java -version && sbt sbtVersion && scala -version
SHELL
config.vm.provision "neovim", type:"shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository -y ppa:neovim-ppa/unstable
sudo apt-get update
sudo apt-get install -y neovim python-dev python-pip python3-dev python3-pip
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 15
sudo update-alternatives --auto vi
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 15
sudo update-alternatives --auto vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 15
sudo update-alternatives --auto editor
nvim --version
SHELL
config.vm.provision "vim", type:"shell", inline: <<-SHELL
sudo apt-get -y install vim
sudo apt-get install -y rake ruby exuberant-ctags git python-pip
bash <(wget -q -O - https://raw.githubusercontent.com/carlhuda/janus/master/bootstrap.sh)
mkdir -p ~/.janus
pushd .
cd ~/.janus
git clone https://github.com/vim-scripts/Rename2.git rename2
popd
mkdir -p ~/.config
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
vim --version
SHELL
config.vm.provision "ensime", type:"shell", inline: <<-SHELL
sudo apt-get install -y python-pip
sudo pip install websocket-client
mkdir -p ~/.sbt/0.13/plugins
echo 'cancelable in Global := true' >> ~/.sbt/0.13/global.sbt
echo 'addSbtPlugin("org.ensime" % "ensime-sbt" % "0.4.0")' >> ~/.sbt/0.13/plugins/plugins.sbt
pushd .
mkdir -p ~/.janus
cd ~/.janus
git clone https://github.com/ensime/ensime-vim.git
popd
SHELL
config.vm.provision "dependencies", type:"shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y git
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment