4 # Tails: https://tails.net/
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://127.0.0.1/dev/null'
26 ENV['EXPORTED_VARIABLES'] ||= ''
27 env_vars = ENV.select { |k, _| ENV['EXPORTED_VARIABLES'].split.include?(k) }
28 .map { |k, v| "#{k}='#{v}'" }.join(' ')
31 inline: "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 domain.machine_type = ENV['TAILS_BUILD_MACHINE_TYPE'] || 'q35'
42 if ENV['TAILS_BUILD_CPU_MODEL']
43 domain.cpu_mode = 'custom'
44 domain.cpu_model = ENV['TAILS_BUILD_CPU_MODEL']
46 domain.cpu_mode = 'host-passthrough'
48 domain.emulator_path = '/usr/bin/qemu-system-x86_64'
49 cpus = ENV['TAILS_BUILD_CPUS'].to_i
50 domain.memory = if ENV['TAILS_RAM_BUILD']
51 vm_memory_for_ram_builds(cpus)
53 vm_memory_for_disk_builds(cpus)
56 if ENV['TAILS_PROXY_TYPE'] == 'vmproxy'
58 :file, size: '15G', allow_existing: true,
59 path: 'apt-cacher-ng-data.qcow2'
62 if ENV['TAILS_WEBSITE_CACHE'] == '1'
64 :file, size: '3G', allow_existing: true,
65 path: 'tails-website-cache.qcow2'