106 lines
3.3 KiB
Ruby
Executable File
106 lines
3.3 KiB
Ruby
Executable File
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
unless ENV["VAGRANT_BYPASS_REQUIRED_PLUGINS"]
|
|
required_plugins = [ "vagrant-disksize", "vagrant-vbguest", "vagrant-reload" ]
|
|
plugins_installed = required_plugins.reduce(true) do |pi, rp|
|
|
pi && Vagrant.has_plugin?(rp)
|
|
end
|
|
|
|
unless plugins_installed
|
|
STDERR.puts "ERROR: Required plugins not installed!"
|
|
STDERR.puts "This vagrant configuration requires the following plugins: #{required_plugins.join(' ')}"
|
|
STDERR.puts "Please install these using the `vagrant plugin install` command and try again"
|
|
exit 127
|
|
end
|
|
end
|
|
|
|
gui_enabled = ENV['VAGRANT_GUI'] || true
|
|
|
|
# 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|
|
|
config.vm.box = "ubuntu/jammy64"
|
|
|
|
# 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 private network, which allows host-only access to the machine
|
|
# using a specific IP.
|
|
# config.vm.network "private_network", ip: "192.168.33.10"
|
|
|
|
# Share a folder between guest and host for convenience
|
|
config.vm.synced_folder File.join(".", "data"), "/media/data"
|
|
|
|
# Use vagrant-disksize plugin to resize disk as desired
|
|
config.disksize.size = ENV["VAGRANT_DISKSIZE"] || "20GB"
|
|
|
|
config.vm.provider "virtualbox" do |vb|
|
|
vb.memory = ENV['VAGRANT_MEMORY'] || 1024 * 8
|
|
vb.cpus = ENV['VAGRANT_CPUS'] || 4
|
|
|
|
# Graphical settings
|
|
vb.gui = gui_enabled
|
|
if gui_enabled
|
|
vb.customize ["modifyvm", :id, "--monitorcount", (ENV['VAGRANT_MONITORS'] || '1')]
|
|
|
|
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
|
vb.customize ["modifyvm", :id, "--vram", "256"]
|
|
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
|
|
vb.customize ["modifyvm", :id, "--accelerate2dvideo", "on"]
|
|
|
|
# Clipboard sharing
|
|
vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
|
|
|
|
end
|
|
|
|
# Use hosts DNS resolver
|
|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
end
|
|
|
|
config.vm.define "default", primary: true do |primary|
|
|
end
|
|
|
|
config.vm.define "test", autostart: false do |test|
|
|
end
|
|
|
|
# Update apt and install custom specified packages
|
|
config.vm.provision :shell,
|
|
name: "Install APT Packages",
|
|
path: "provisioners/install-apt-packages.sh"
|
|
|
|
# config.vm.provision :shell,
|
|
# name: "Install Minimal XFCE",
|
|
# path: "provisioners/install-xfce-minimal.sh" \
|
|
# if gui_enabled
|
|
|
|
config.vm.provision :shell,
|
|
name: "Install Minimal KDE",
|
|
path: "provisioners/install-kde-minimal.sh" \
|
|
if gui_enabled
|
|
|
|
config.vm.provision :shell,
|
|
name: "Install Nix",
|
|
path: "provisioners/install-nix.sh",
|
|
privileged: false
|
|
|
|
config.vm.provision :shell,
|
|
name: "Cleanup tasks",
|
|
inline: <<~SHELLEND
|
|
userdel ubuntu
|
|
SHELLEND
|
|
|
|
# Run any personal customization that exist outside git
|
|
if Dir.exists?('personal')
|
|
Dir['personal/*.sh'].each do |script|
|
|
config.vm.provision :shell, path: script, privileged: false
|
|
end
|
|
end
|
|
|
|
config.vm.provision :reload
|
|
end
|