lima icon indicating copy to clipboard operation
lima copied to clipboard

Suggestion: allow using "." in mount location and\or scripts

Open centur opened this issue 2 years ago • 0 comments

Description

Hi, first - thanks for the great project, lima is a first thing that worked properly from the start on M1 Mac for me, 💯 👍 .

I'm trying to build dev environment for the project using lima-vm and found that I need somehow map dirs which are relative to lima yaml file. The scenario is to have a VM with installed tools (provisioning scripts work great for installing tools but not for adding configs) and configuration for tools from a repository. To achieve this I need some form of "relative" path to be mapped into vm on creation. There is an example of such path - ~ is expanded to user's home directory when used in mounts.location. Can we have something like . and .. or some other path expansion tokens, which would be expanded to a current template file directory, so during VM creation we can use something like:

mounts:
  - location: "./../config"
     mountPoint: /opt/hashicorp/config # will be supported in next version
     writable: false

to map certain folders from host to guest.

Technically it can be achieved today by specifying a location path relative to home, e.g. - location: "~/myprojects/project-name/devenv/config" but it's less portable as different developers may have different structure in their home dir.

Mount point is probably an ideal case, as it will be in sync all the time and can be updated from host with changes reflected in guest. Alternative options may be (1) to allow location to be dynamically specified in limactl start command or (2) have an original template directory mounted in provisioning scripts. In the latter case I can simply copy latest config files in a provisioning script but have to restart an underlying VM.

Alternatives are not ideal but would work better, than asking developer to edit template and point to his project path before creating a vm from a template.

centur avatar Jun 10 '22 00:06 centur