-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
83 lines (64 loc) · 2.01 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
$DEFAULTS = {
:cpus => 1,
:mem => 2048,
}
# Required plugins. If you encounter errors relating to fog, try manually
# installing fog-libvirt
required_plugins = %w[vagrant-env vagrant-libvirt vagrant-reload]
return if !Vagrant.plugins_enabled?
plugins_to_install = required_plugins.select { |plugin|
!Vagrant.has_plugin?(plugin)
}
if plugins_to_install.any?
system("vagrant plugin install #{plugins_to_install.join(' ')}",
:chdir=>"/tmp")
exit
end
# Guest config
ENV["LC_ALL"] = "en_US.UTF-8"
ENV['VAGRANT_DEFAULT_PROVIDER'] = "libvirt"
ENV["BOX_NAME"] = "fedora/38-cloud-base"
Vagrant.configure("2") do |config|
config.env.enable
# Box
config.vm.box = ENV["BOX_NAME"]
# Hostname
hostname = "kmod-sel4vm-devel-#{ENV["BOX_NAME"].rpartition("/")[-1]}"
config.vm.hostname = hostname
# disable default sync
config.vm.synced_folder '.', '/vagrant', disabled: true
# Sync code to guest
# Firewall must allow ports:
# nfs 2049 ALLOW <ip>/24
config.vm.synced_folder "./", "/home/vagrant/sel4",
type: "nfs",
nfs_version: 4,
nfs_udp: false
config.vm.network "private_network", type: "dhcp"
config.vm.define hostname do |machine_name|
machine_name.vm.provider "libvirt" do |lv, override|
lv.cpus = $DEFAULTS[:cpus]
lv.memory = $DEFAULTS[:mem]
lv.driver = "kvm"
lv.nested = true
lv.disk_bus = "virtio"
lv.disk_driver[:cache] = 'directsync'
lv.nic_model_type = 'virtio'
lv.management_network_name = 'kmod-sel4vm-devel'
lv.management_network_address = '192.168.146.0/24'
lv.management_network_guest_ipv6 = false
# Workaround for private network error
lv.qemu_use_session = false
end
end
# Provision devel tools
$script = <<-SCRIPT
sudo dnf upgrade -y
sudo dnf install kernel-devel -y
SCRIPT
config.vm.provision "shell", inline: $script
config.vm.provision :reload
end