diff --git a/crates/muvm/src/guest/mount.rs b/crates/muvm/src/guest/mount.rs index 02c507d..232299b 100644 --- a/crates/muvm/src/guest/mount.rs +++ b/crates/muvm/src/guest/mount.rs @@ -14,6 +14,13 @@ use rustix::mount::{ use rustix::path::Arg; use serde_json::json; +/// A list of directories in /run to be passed through from the host. +const RUN_PASSTHRU: [&str; 2] = [ + // NixOS-specific directories. + "current-system", + "opengl-driver", +]; + fn make_tmpfs(dir: &str) -> Result<()> { mount2( Some("tmpfs"), @@ -313,6 +320,13 @@ pub fn mount_filesystems(merged_rootfs: bool) -> Result<()> { ) .context("Failed to mount `/dev/shm`")?; + for dir in RUN_PASSTHRU { + let src = Path::new("/run/muvm-host/run").join(dir); + if src.exists() { + symlink(src, Path::new("/run").join(dir))?; + } + } + // Do this last so it can pick up all the submounts made above. if let Err(e) = mount_fex_rootfs(merged_rootfs) { println!("Failed to mount FEX rootfs, carrying on without. Error: {e}");