4 # Tails: The Amnesic Incognito Live System
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 require_relative 'lib/tails_build_settings'
21 ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
23 Vagrant.configure("2") do |config|
24 config.vm.box = box_name
25 config.vm.box_url = "http://dl.amnesia.boum.org/tails/project/vagrant/#{config.vm.box}.box"
26 config.vm.box_url = "http://127.0.0.1/dev/null"
27 ENV['EXPORTED_VARIABLES'] ||= ""
28 env_vars = ENV.select { |k,v| ENV['EXPORTED_VARIABLES'].split.include?(k) }
29 .map { |k, v| "#{k}='#{v}'" } .join(' ')
30 config.vm.provision "shell", inline: <<-EOF
31 sudo #{env_vars} /vagrant/provision/setup-tails-builder
33 config.vm.synced_folder '.', '/vagrant', type: '9p', readonly: true
34 config.vm.synced_folder '..', '/amnesia.git', type: '9p', readonly: true
35 config.vm.provider :libvirt do |domain|
36 domain.default_prefix = config.vm.box
38 domain.management_network_guest_ipv6 = 'no'
39 domain.connect_via_ssh = false
40 domain.machine_arch = 'x86_64'
41 if ENV['TAILS_BUILD_MACHINE_TYPE']
42 domain.machine_type = ENV['TAILS_BUILD_MACHINE_TYPE']
44 domain.machine_type = 'q35'
46 if ENV['TAILS_BUILD_CPU_MODEL']
47 domain.cpu_mode = 'custom'
48 domain.cpu_model = ENV['TAILS_BUILD_CPU_MODEL']
50 domain.cpu_mode = 'host-passthrough'
52 domain.emulator_path = '/usr/bin/qemu-system-x86_64'
53 domain.memory = ENV['TAILS_RAM_BUILD'] ? VM_MEMORY_FOR_RAM_BUILDS :
54 VM_MEMORY_FOR_DISK_BUILDS
55 cpus = ENV['TAILS_BUILD_CPUS']
56 domain.cpus = cpus unless cpus.nil?
57 if ENV['TAILS_PROXY_TYPE' ] == 'vmproxy'
59 :file, size: '15G', allow_existing: true,
60 path: 'apt-cacher-ng-data.qcow2'