# -*- mode: ruby -*-
# vi: set ft=ruby :

ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
Vagrant.configure("2") do |config|
  config.vm.define "OpenBSD - trusting-make"
  config.vm.box = "sk4nz/opack-trusting-make"
  config.ssh.shell = "ksh -l"
  config.ssh.username = "root"
  config.ssh.extra_args = "-tt"
  config.ssh.sudo_command = "doas env %c"
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.synced_folder "./src/", "/root/trusting-make", type: "rsync",
    :rsync__args => ["-a", "-e 'ssh -T -c arcfour -o Compression=no -x'"],
    :rsync__rsync_path => "doas rsync",
    :rsync__chown => false
  config.vm.synced_folder "./openbsd_src/", "/usr/src", type: "rsync",
    :rsync__args => ["-a", "-e 'ssh -T -c arcfour -o Compression=no -x'"],
    :rsync__rsync_path => "doas rsync",
    :rsync__chown => false
  config.vm.provision "trusting-make", type: "shell" do |s|
    s.inline = "echo hw.smt=1 >> /etc/sysctl.conf; \
                  echo vm.malloc_conf= >> /etc/sysctl.conf; \
                  echo kern.shminfo.shmmax=335544320 >> /etc/sysctl.conf; \
                  echo kern.shminfo.shmseg=1280 >> /etc/sysctl.conf; \
                  sysctl hw.smt=1; \
                  sysctl vm.malloc_conf=; \
                  sysctl kern.shminfo.shmmax=335544320; \
                  sysctl kern.shminfo.shmseg=1280; \
                  pkg_add -u; \
                  pkg_add git htop coreutils base64 radare2 vim--no_x11; \
                  "
  end
  config.vm.provider "libvirt" do |l|
    l.cpus = 4
    l.memory = 2048
  #  l.uri = 'qemu:///system'
  end
end
