spotlights-macbook-air: Initialize muvm

This commit is contained in:
Spotlight 2025-02-27 23:44:20 -06:00
parent 05a7847913
commit b428477394
Signed by: spotlight
GPG key ID: 874AA355B3209BDC
6 changed files with 248 additions and 2 deletions

View file

@ -0,0 +1,32 @@
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}");