Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/bionic64"

  config.vm.provider "virtualbox" do |v|
    v.memory = 2048
    v.cpus = 3
  end

  config.vm.provision "shell", inline: <<-SHELL
    apt-get update && apt-get install --no-install-recommends -y \
        cmake     \
        emacs     \
        g++       \
        git       \
        make      \
        meld      \
        mercurial \
        python    \
        xauth

    hg clone https://bitbucket.org/aibasel/planopt-hs19 /vagrant/planopt-hs19

    git clone https://github.com/KCL-Planning/VAL.git
    bash ./VAL/scripts/linux/build_linux64.sh Validate release
    mv VAL/build/linux64/release/install/bin/* /usr/bin/
    rm -rf VAL
    echo '#!/bin/bash
Validate "$1" "$2" <(grep -v ";" "$3" | nl -s ": ") 
' > /usr/bin/validate
    chmod 0755 /usr/bin/validate
    cd /vagrant/planopt-hs19/demo/fast-downward
    ./build.py
  SHELL

  config.ssh.forward_x11 = true
  config.ssh.forward_agent = true
end
