AsahiLinux / krun

krun - run programs from your system in a microVM
51 stars 8 forks source link

Passthru NixOS system & OpenGL Driver #38

Open RossComputerGuy opened 3 months ago

RossComputerGuy commented 3 months ago

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

RossComputerGuy commented 3 months ago

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 commented 2 months ago

@teohhanhui PTAL.

teohhanhui commented 2 months ago

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 commented 2 months ago

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.