]> git.donarmstrong.com Git - qmk_firmware.git/blob - Vagrantfile
[Keyboard] leds in default keymap (#6357)
[qmk_firmware.git] / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 Vagrant.configure(2) do |config|
5   # define a name instead of just 'default'
6   config.vm.define "qmk_firmware"
7
8   # VMware/Virtualbox ( and also Hyperv/Parallels) 64 bit
9   config.vm.box = "generic/debian9"
10   
11   config.vm.synced_folder '.', '/vagrant'
12
13   # This section allows you to customize the Virtualbox VM
14   # settings, ie showing the GUI or upping the memory
15   # or cores if desired
16   config.vm.provider "virtualbox" do |vb|
17     # Hide the VirtualBox GUI when booting the machine
18     vb.gui = false
19     # Uncomment the below lines if you want to program
20     # your Teensy via the VM rather than your host OS
21     #vb.customize ['modifyvm', :id, '--usb', 'on']
22     #vb.customize ['usbfilter', 'add', '0',
23     #         '--target', :id,
24     #         '--name', 'teensy',
25     #         '--vendorid', '0x16c0',
26     #         '--productid','0x0478'
27     #        ]
28     # Customize the amount of memory on the VM:
29     vb.memory = "512"
30     # Uncomment the below lines if you have time sync
31     # issues with make and incremental builds
32     #vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ]
33   end
34
35   # This section allows you to customize the VMware VM
36   # settings, ie showing the GUI or upping the memory
37   # or cores if desired
38   config.vm.provider "vmware_workstation" do |vmw|
39     # Hide the VMware GUI when booting the machine
40     vmw.gui = false
41
42     # Customize the amount of memory on the VM:
43     vmw.memory = "512"
44   end
45
46   config.vm.provider "vmware_fusion" do |vmf|
47     # Hide the vmfare GUI when booting the machine
48     vmf.gui = false
49
50     # Customize the amount of memory on the VM:
51     vmf.memory = "512"
52   end
53
54   # Docker provider pulls from hub.docker.com respecting docker.image if
55   # config.vm.box is nil. In this case, we adhoc build util/vagrant/Dockerfile.
56   # Note that this bind-mounts from the current dir to
57   # /vagrant in the guest, so unless your UID is 1000 to match vagrant in the
58   # image, you'll need to: chmod -R a+rw .
59   config.vm.provider "docker" do |docker, override|
60     override.vm.box = nil
61     docker.build_dir = "util/vagrant"
62     docker.has_ssh = true
63   end
64
65   # Unless we are running the docker container directly
66   #   1. run container detached on vm
67   #   2. attach on 'vagrant ssh'
68   ["virtualbox", "vmware_workstation", "vmware_fusion"].each do |type|
69     config.vm.provider type do |virt, override|
70       override.vm.provision "docker" do |d|
71         d.run "qmkfm/base_container",
72           cmd: "tail -f /dev/null",
73           args: "--privileged -v /dev:/dev -v '/vagrant:/vagrant'"
74       end
75
76       override.vm.provision "shell", inline: <<-SHELL
77         echo 'docker restart qmkfm-base_container && exec docker exec -it qmkfm-base_container /bin/bash -l' >> ~vagrant/.bashrc
78       SHELL
79     end
80   end
81
82   config.vm.post_up_message = <<-EOT
83
84   Log into the environment using 'vagrant ssh'. QMK directory synchronized with
85   host is located at /vagrant
86   To compile the .hex files use make command inside this directory, e.g.
87      cd /vagrant
88      make <keyboard>:default
89
90   Examples:
91      make planck/rev4:default:dfu
92      make planck:default
93
94   EOT
95 end