Virtual machine based development environment for a variety of programming languages
- Repeatable development environment for all users.
- Easy to develop the same codebase on multiple computers.
- Fully automatic confiugration of development tools and plugins.
- Can be used as as standalone development environment or as a template to start a project specific development environment.
- Quick and easy to configure the first time.
- Fast to start up each time it is needed.
- Share files with the host machine.
- Minimum requirements for the host machine.
- Desktop GUI available if needed.
- Virtualization allowed in the development environment (use Docker inside the VM if needed)
- Supports Windows host machine (others should work too but are not tested at this time)
Virtualization is provided by Vagrant by HashiCorp using the Hyper-V provider.
Provisioning of the virtual machine is done first by running the provisioning/provision.sh
script. This installs all of the development tools and configures them. This is designed to be safe to run multiple times. It is also safe to run this script manually from within the virtual machine.
Postgresql is provisioned using a third party postgresql Ansible role as a submodule.
- Elixir
- Javascript
- C/C++
- Python
- Rescript
Hyper-V is hardware virtualization provided by Windows. It requires Windows 10 Pro or higher. Read more here.
You can enable Hyper-V by following the Microsoft instructions: Install Hyper-V on Windows 10
Alternatively, you can enable Hyper-V by running the following PowerShell command as an Admin:
Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All
You may also need to create a Virtual Switch for Hyper-V. If so (you will know because vagrant up
will fail), you can create one with:
New-VMSwitch -name InternalSwitch -SwitchType Internal
More info on Virtual Switches here: Create a virtual switch for Hyper-V virtual machines
Recommend using alacritty as the terminal on the Windows host. It is GPU accelerated, so it has the best performance of terminals I have found. Particularly when re-rendering the full screen, like you do when moving between tabs in vim.
Preferred font: Consolas NF
Configure Alacritty to use the font by creating or editing ~\AppData\Roaming\alacritty\alacritty.yml
with:
# Font configuration (changes require restart)
font:
# The size to use.
size: 12
# The normal (roman) font face to use.
normal:
family: Consolas NF
# Style can be specified to pick a specific face.
style: Book
# The bold font face
bold:
family: Consolas NF
# Style can be specified to pick a specific face.
style: Bold
# The italic font face
italic:
family: Consolas NF
# Style can be specified to pick a specific face.
style: Italic
cd C:\Path\to\this\file
vagrant up
The first run of this command took 22 minutes on my laptop.
vagrant ssh
You can start the ssh connection to the vagrant VM with port forwarding. This example forwards host port 4040 to VM port 4000. You can forward the same port number as well.
vagrant ssh -- -L 4040:localhost:4000
I had trouble getting ZSH to stick as the default shell. You can run this to set it.
sudo chsh -s $(which zsh) $(whoami)
Note: you will need to log out and reconnect for the change to take effect.
There is no setup to share the host clipboard with the VM. You can copy paste text directly within Alacritty. Copy paste shortcuts for Alacritty are Ctrl+Shift+C and Ctrl+Shift+V. The problem is this also copies any text along the left edge (line numbers and git gutter). These can be disabled with:
set nonumber norelativenumber
set signcolumn=no