Skip to content

Configure Local Minicoin

Volker Hilsheimer edited this page Mar 7, 2022 · 3 revisions

While minicoin is usable out of the box, getting the best performance requires some tweaking of user- or project-specific configurations.

The default configuration can be overridden extended with user and project specific settings. User specific settings live in ~/minicoin/minicoin.yml, and project specific settings are loaded from the first .minicoin/minicoin.yml file found in the current working directory tree.

Create an empty text file ~/minicoin/minicoin.yml and fire up your favourite editor.

Optimized default machine configuration

We can make settings that apply to all or some machines in the settings: section by specifying a regular expression.

settings:
  /.*/: # matches all machines

To get the most out of local VMs, we can make sure that they get enough compute resources, i.e. CPU and RAM. How many resources we can assign to each VM depends on the local host's CPU count and RAM, and on how many VMs we might want to run in parallel. As a rule of thumb, we should allocate at least 1 GB of RAM per CPU core, but make it 2 GB per core if you can:

settings:
  /.*/:
    cpus: 4
    memory: 8196

We also want to make sure that for all machines, we set up the syncing of key directories via the fast mutagen file system synching (rather than relying on the rather slow file access via folder sharing that providers like VirtualBox and VMware implement):

    shared_folders:
      mutagen:
        - ~/qt/dev

This will create a file system sync for the local dev worktree of Qt for all machines so that on the guest VM, a copy of your local ~/Qt/dev will be in /home/vagrant/qt/dev or /Users/vagrant/qt/dev or C:\Users\vagrant\qt\dev, depending on the guest OS. Adjust this according to your local file system layout, and add more paths if you want.

Settings for groups of machines

So far settings were applied to all machines matching /.*/, but we can also apply such global settings to a subset of machines.

  /windows.*/: # for all machines that match this regular expression
    roles:
      - windows-tools

This provisions all Windows machines with the windows-tools role, which installs a number of general purpose software development packages such as git or perl.

Machine specific overrides

We can override an extend the settings of individual machines as well in our user minicoin.yml file. So far we have given all machines 4 virtual CPUs and 8 GB of RAM, but if we know that we most frequently use the windows11 machine to run builds and tests, then we might want to give that machine some extra computing power. Add a machines: section and make the respective settings:

machines:
  - name: windows11 # overrides the default windows11 machine
    cpus: 8
    memory: 16392 # 16 GB of RAM

Testing the total configuration

To confirm that everything is set up and that the settings from the various sources get merged correctly, run

$ minicoin describe windows11

This should generate YAML output of the merged configuration, and is practical for debugging issues and when reporting minicoin bugs. The output should be something like this:

---
machine:
  name: windows11
  box: tqtc/windows11
  roles:
  - windows-tools
  - msvc2019
  - windows-setup
  shared_folders:
    "$PWD": "/opt/minicoin"
    "$HOME_SHARE": "$GUEST_HOMES/$USER"
    mutagen:
    - "~qt/dev"
  cpus: 8
  memory: 16392
  os: windows
  nictype1: 82540EM
  ports:
  - id: rdp
  rdp: true
  nictype2: 82540EM
fs_mappings:
  ".": C:\opt\minicoin
  "/Users/you": C:\Users\you
  "~/qt/dev": C:/Users/vagrant/qt/dev
default_shared_folders:
  ".": "/opt/minicoin"
  "/Users/you": "/you"
hash: 80
guest_homes: C:\Users

The roles, cpus, and memory settings that we added to the user minicoin.yml file are all there, together with many settings from the default file, or generated by minicoin at runtime.

Bring the machine up with

$ minicoin up windows11

and wait for the booting and the provisioning to complete. Check your provider, most likely VirtualBox or VMware, and confirm that the CPU and RAM settings are applied.

Next: Building Qt in a local Windows VM

Clone this wiki locally