Skip to content
Snippets Groups Projects
Vagrantfile 2.41 KiB
Newer Older
  • Learn to ignore specific revisions
  • # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    #
    # Tails: The Amnesic Incognito Live System
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    require_relative 'lib/tails_build_settings'
    
    ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
    
    
    Vagrant.configure("2") do |config|
    
      config.vm.box_url = "http://dl.amnesia.boum.org/tails/project/vagrant/#{config.vm.box}.box"
    
      config.vm.box_url = "http://127.0.0.1/dev/null"
    
      ENV['EXPORTED_VARIABLES'] ||= ""
      env_vars = ENV.select { |k,v| ENV['EXPORTED_VARIABLES'].split.include?(k) }
                       .map { |k, v| "#{k}='#{v}'" } .join(' ')
    
      config.vm.provision "shell", inline: <<-EOF
    
        sudo #{env_vars} /vagrant/provision/setup-tails-builder
    
      config.vm.synced_folder '.', '/vagrant', type: '9p', readonly: true
    
      config.vm.synced_folder '..', '/amnesia.git', type: '9p', readonly: true
    
    anonym's avatar
    anonym committed
      config.vm.provider :libvirt do |domain|
    
        domain.default_prefix = config.vm.box
    
    anonym's avatar
    anonym committed
        domain.driver = 'kvm'
    
        domain.management_network_guest_ipv6 = 'no'
    
    anonym's avatar
    anonym committed
        domain.connect_via_ssh = false
        domain.machine_arch = 'x86_64'
    
        if ENV['TAILS_BUILD_MACHINE_TYPE']
          domain.machine_type = ENV['TAILS_BUILD_MACHINE_TYPE']
        else
          domain.machine_type = 'q35'
        end
    
        if ENV['TAILS_BUILD_CPU_MODEL']
          domain.cpu_mode  = 'custom'
          domain.cpu_model = ENV['TAILS_BUILD_CPU_MODEL']
        else
          domain.cpu_mode = 'host-passthrough'
        end
    
    anonym's avatar
    anonym committed
        domain.emulator_path = '/usr/bin/qemu-system-x86_64'
    
    anonym's avatar
    anonym committed
        domain.memory = ENV['TAILS_RAM_BUILD'] ? VM_MEMORY_FOR_RAM_BUILDS :
                                                 VM_MEMORY_FOR_DISK_BUILDS
    
        cpus = ENV['TAILS_BUILD_CPUS']
    
    anonym's avatar
    anonym committed
        domain.cpus = cpus unless cpus.nil?
    
        if ENV['TAILS_PROXY_TYPE' ] == 'vmproxy'
          domain.storage(
    
            :file, size: '15G', allow_existing: true,