-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: allow using "." in mount location and\or scripts #893
Comments
I really don't understand what the relative filenames would be relative to, and how this wouldn't still be somehow depending on how a developer sets up their environment. I've added some comments in #1351 (comment) about the difficulty of figuring out what base to use to resolve relative pathnames in Why not tell the user to set an environment variable (inside env:
MY_CONFIG: ~/.my_config
message: |
Using config settings from {{.Config.Env.MY_CONFIG}}
Change the config file by stopping the VM and then run `limactl edit {{.Name}}` It will be displayed by
The variable needs to point to a location that is mounted inside the instance, of course. And unless/until #287 is implemented, the config file content will not be accessible from the provisioning scripts because the mounts haven't happened yet. Well, if you use |
@jandubois The idea here was to allow addressing not from user's home directory, but from Simple example may clarify this idea: If we are working on the same project and want to use one shared I hope this adds a bit more context to the original description of the suggestion |
I assume from the rest of your reply that you are not talking about the As I pointed out in #1351 (comment), this is not always easy. Let's say the instance is started by $ limactl start https://raw.githubusercontent.com/lima-vm/lima/master/examples/alpine.yaml What would And how would we deal with this when the instance is restarted while the host is offline? Do we need to cache the data? Or would the VM fail to restart? Any mechanism we implement in Lima itself should be generic enough to work meaningfully in all possible configurations. What I could see supporting would be setting an environment variable in LIMA_TEMPLATE=/usr/local/share/lima/examples/alpine.yaml Of course the value might be a URL, like LIMA_TEMPLATE=https://raw.githubusercontent.com/lima-vm/lima/master/examples/alpine.yaml and then it is up to your tools to figure out what to do with it. PS: I wouldn't want to hard-code this into Lima either, but provide template expansion for environment variables, and then allow you to do this yourself with something like this: env:
LIMA_TEMPLATE: {{.LimaTemplate}} That way we can make additional useful settings available as additional template variables. |
I'm wondering if what we really want is something like But I'm not sure if there is wide enough interest in that. Also not clear if this should be part of |
Personally I don't think "docker compose" style would have a good efforts/benefits ratio, it's a massive task but for the (my) simple goal of creating repository-stored lima-based dev environments in yaml files - it's an overkill. I see what's the problem with using lima with URLs and now I see the point of why it's hard, because it's not always local. Expanding environment variables may work well here, as the local path would not be Env vars expansion would work for my case, I assume. Probably it'd be great to have a working example of this specific scenario (I haven't touched my initial "spike" with lima that I did last year when I stumbled over this issue). |
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 inmounts.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: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.
The text was updated successfully, but these errors were encountered: