feat: Auto-initialize the host paths of shares#316
feat: Auto-initialize the host paths of shares#316lordkekz wants to merge 3 commits intomicrovm-nix:mainfrom
Conversation
astro
left a comment
There was a problem hiding this comment.
This is a useful improvement. Can anyone think of any host setup that could be broken by this?
|
Oh wait, this PR is only for declarative VMs! To cover all use-cases, the |
Ah, sorry for only now getting around to answering. I meant to only create the directories for declarative VMs, but I'm open to also creating them for non-declarative VMs (it's probably even more useful there).
If I move the |
79d5ddb to
b1e2013
Compare
|
Any updates on this? This is currently my only issue with this project. |
| '' | ||
| # Make sure that the sources of the shares can be accessed. | ||
| # Also ignore failures of each command for now | ||
| + builtins.foldl' (acc: share: | ||
| acc + lib.optionalString (share.source != "/nix/store") '' | ||
| # Initialize permissions for share with mountPoint ${share.mountPoint} | ||
| mkdir -p '${share.source}' || : | ||
| chown -hR ${user}:${group} '${share.source}' || : | ||
| '') "" guestConfig.microvm.shares; |
There was a problem hiding this comment.
This should be done via systemd.tmpfiles
Hi, thanks for this amazing project!
I wanted to share a little patch here and hear your opinion if you want to add this kind of feature. I'm looking forward to your feedback!
Motivation
microvm:kvmuser they will not be accessible for the guest, leading to somewhat surprising errors.Proposed change
install-microvm-...unit creates the directories for shares on the host.install-microvm-...unit recursively chowns the directories for the configured runner user.Issues / TODO
mkdiris not the desired way to create the share source directories, e.g. if one wants to mount a zfs dataset or btrfs subvolume in the location.