You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.1 KiB

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