Vagrantfile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. Vagrant.configure("2") do |config|
  2. config.vm.define "debian", primary: true do |debian|
  3. debian.vm.box = "generic/debian12"
  4. debian.vm.synced_folder ".", "/home/vagrant/openfreebuds"
  5. debian.vm.provision "shell",
  6. run: 'once',
  7. name: "Prepare base dependencies (Python, Just, PDM)",
  8. privileged: true,
  9. inline: <<-SHELL
  10. apt update
  11. apt install -y --no-install-recommends pipx curl flatpak python-is-python3 python3-venv
  12. # Install qasync (not in Debian repos, required for packaging as runtime dep)
  13. # Since Debian 13, will be in main repo
  14. curl -s -o /tmp/qasync.deb https://deb.mmk.pw/pool/main/q/qasync/python3-qasync_0.27.1-4_all.deb
  15. apt install -y --no-install-recommends /tmp/qasync.deb
  16. rm /tmp/qasync.deb
  17. # Install Just
  18. # Since Debian 13, will be in main repo
  19. if [ ! -f /usr/local/bin/just ]
  20. then
  21. curl -s https://just.systems/install.sh | bash -s -- --to /usr/local/bin
  22. fi
  23. # Install PDM for user
  24. if [ ! -f /home/vagrant/.local/bin/pdm ]
  25. then
  26. curl -sSL https://pdm-project.org/install-pdm.py | sudo -u vagrant python3 -
  27. fi
  28. SHELL
  29. debian.vm.provision "shell",
  30. run: 'always',
  31. name: "Install project dependencies",
  32. privileged: false,
  33. inline: <<-SHELL
  34. cd ~/openfreebuds
  35. just deps_debian prepare
  36. SHELL
  37. debian.vm.provision "shell",
  38. run: 'always',
  39. name: "Build binaries",
  40. privileged: false,
  41. inline: <<-SHELL
  42. export FLATPAKBUILDDIR=$HOME/flatpak
  43. cd ~/openfreebuds
  44. just --evaluate
  45. just build debian
  46. SHELL
  47. debian.vm.provision "shell",
  48. run: 'once',
  49. name: "Install Flatpak requirements and build Flatpak bundle",
  50. privileged: false,
  51. inline: <<-SHELL
  52. export FLATPAKBUILDDIR=$HOME/flatpak
  53. flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
  54. flatpak install -y --user org.flatpak.Builder
  55. cd ~/openfreebuds
  56. just build flatpak
  57. SHELL
  58. end
  59. config.vm.define "windows", primary: true do |win|
  60. win.vm.box = "gusztavvargadr/windows-11-24h2-enterprise"
  61. win.vm.synced_folder ".", "C:\\openfreebuds"
  62. win.vm.provider "vmware_desktop" do |v|
  63. v.vmx["numvcpus"] = "4"
  64. v.vmx["memsize"] = "4096"
  65. v.gui = true
  66. end
  67. win.vm.provision "shell",
  68. run: 'once',
  69. name: "Prepare base dependencies (Just, Python, VSBuildTools, NSIS, UPX)",
  70. privileged: true,
  71. inline: <<-SHELL
  72. powercfg.exe -x -standby-timeout-ac 0
  73. powercfg.exe -x -standby-timeout-dc 0
  74. powercfg.exe -x -hibernate-timeout-ac 0
  75. powercfg.exe -x -hibernate-timeout-dc 0
  76. if (-Not (Get-Command 'winget' -errorAction SilentlyContinue)) {
  77. echo 'Sleep for 60s for winget appear...'; Start-Sleep -s 60
  78. }
  79. winget install -e --accept-source-agreements --no-upgrade --id Casey.Just
  80. winget install -e --no-upgrade --id NSIS.NSIS
  81. winget install -e --no-upgrade --id UPX.UPX
  82. winget install -e --no-upgrade --id Python.Python.3.12
  83. # Only for Python 3.13+
  84. # winget install -e --no-upgrade --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended"
  85. SHELL
  86. win.vm.provision "shell",
  87. run: 'once',
  88. name: "Prepare PDM",
  89. privileged: true,
  90. inline: <<-SHELL
  91. powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | python -"
  92. SHELL
  93. win.vm.provision "shell",
  94. run: 'once',
  95. name: "Prepare project dependencies",
  96. privileged: true,
  97. inline: <<-SHELL
  98. cd C:\\openfreebuds
  99. just prepare
  100. SHELL
  101. win.vm.provision "shell",
  102. run: 'once',
  103. name: "Build project",
  104. privileged: true,
  105. inline: <<-SHELL
  106. cd C:\\openfreebuds
  107. just --evaluate
  108. just build win32
  109. SHELL
  110. end
  111. end