Skip to content
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

Passthru NixOS system & OpenGL Driver #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RossComputerGuy
Copy link

Fixes #37 by passing thru the NixOS system and OpenGL driver.

@RossComputerGuy
Copy link
Author

Gets as far as:

sommelier_scope_timer: init wayland channel: 0.000250 seconds
DRM_IOCTL_ASAHI_GET_PARAMS failed: Invalid argument
sommelier_scope_timer: drm device: 0.070801 seconds
sommelier_scope_timer: connect display: 0.000026 seconds
sommelier_scope_timer: client create: 0.000015 seconds
sommelier_scope_timer: display implementation: 0.000004 seconds
sommelier_scope_timer: spawn xwayland: 0.000156 seconds
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running

Then hangs, it's progress

@slp
Copy link
Collaborator

slp commented Jun 24, 2024

@teohhanhui PTAL.

@teohhanhui
Copy link
Collaborator

teohhanhui commented Jun 24, 2024

This seems like it's maybe the wrong approach?

https://nixos.wiki/wiki/OpenGL

Disclaimer: I have never used NixOS or even Nix. I'm just basing my judgement on the documentation I can find.

But if this is required, I think we could just automatically mount /run/opengl-driver and /run/current-system (if they exist) without having to pass those env vars (which don't make sense to me...) - WDYT @slp?

@RossComputerGuy
Copy link
Author

RossComputerGuy commented Jun 24, 2024

This seems like it's maybe the wrong approach?

Yeah this is the first time I coded in Rust and I'm not entirely sure how krun works so this was the approach I could come up with.

https://nixos.wiki/wiki/OpenGL

Disclaimer: I have never used NixOS or even Nix. I'm just basing my judgement on the documentation I can find.

New wiki: https://wiki.nixos.org/wiki/OpenGL

/run/opengl-driver is a symlink to a directory in /nix/store and so is /run/current-system. Probably the best way is to read the OpenGL driver path on host and then find if it's a symlink, resolve the symlink of it is, and then pass it through. I'm not sure how /run/current-system could be resolved but as it is in $PATH, could parse that and then resolve and pass through whatever is a symlink.

@asahilina
Copy link
Member

asahilina commented Oct 4, 2024

I'm torn over whether we should share /run as a whole or not. There are things like /run/media that make sense to share. On the other hand, that doesn't work even if you do mount it right now due to missing POSIX ACL support...

One thing we do have since a recent change is /run/muvm-host. That exposes the entire host FS without any overlaid mounts. A simple way of implementing this now would be to check if /run/muvm-host/run/{opengl-driver,current-system} exist and if they do, symlink them back into /run. This could be implemented with a list of things in /run to symlink so it can be easily extended in the future, such as also doing /run/media once that otherwise works.

Aside: I think it's worth implementing a feature to run a user-specified script as root on VM startup. There are going to be people with custom setups who want to do some mount management or other root-requiring tasks on VM startup.

@RossComputerGuy
Copy link
Author

One thing we do have since a recent change is /run/muvm-host. That exposes the entire host FS without any overlaid mounts. A simple way of implementing this now would be to check if /run/muvm-host/run/{opengl-driver,current-system} exist and if they do, symlink them back into /run.

Yeah, I think that might be a good way.

Aside: I think it's worth implementing a feature to run a user-specified script as root on VM startup. There are going to be people with custom setups who want to do some mount management or other root-requiring tasks on VM startup.

True, some sort of pre and post run scripts that could be specific or pulled from home might be good as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with /run on NixOS
4 participants