From 8c3878f117b1e30f3eb97d95f1095fb74ce634d9 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Fri, 13 Feb 2026 14:55:52 -0300 Subject: [PATCH] Pass timezone through to the VM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What a way to discover that this was missing- PipeWire camera was freezing unless something on the host was already streaming it… gstclock.c:1086:gst_clock_get_internal_time: internal time 1:01:04.622699903 gstclock.c:1129:gst_clock_get_time: adjusted time 5123776:20:12.866176008 Well, that wasn't even caused by the TZ but it made me think to fix it.. NOTE for local dev, rebuild micro-activate now --- micro-activate.rs | 2 ++ munix | 4 +++- nixosModules/default.nix | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/micro-activate.rs b/micro-activate.rs index d9d829c..0806e96 100644 --- a/micro-activate.rs +++ b/micro-activate.rs @@ -71,6 +71,7 @@ fn main() -> Result<(), std::io::Error> { // // Let's preserve the fixed passed-in files and set up the NixOS symlinks in the new mount. let resolv_conf = std::fs::read("/run/resolv.conf")?; + let localtime = std::fs::read("/run/localtime")?; assert_eq!( unsafe { mount( @@ -83,6 +84,7 @@ fn main() -> Result<(), std::io::Error> { }, 0 ); + std::fs::write("/run/localtime", &localtime)?; std::fs::write("/run/resolv.conf", &resolv_conf)?; std::fs::write("/run/machine-id", &gen_machine_id())?; std::os::unix::fs::symlink(&closure, "/run/current-system")?; diff --git a/munix b/munix index 9c67084..89d79c3 100755 --- a/munix +++ b/munix @@ -223,6 +223,7 @@ bwrap --unshare-all --share-net \ --symlink "$MICROVM_CLOSURE" /run/current-system \ --ro-bind /nix/store /nix/store \ --file 13 /run/resolv.conf \ + --file 14 /run/localtime \ --dir "$XDG_RUNTIME_DIR" \ --setenv PATH "/run/munix/muvm:/run/munix/passt:$MICROVM_CLOSURE/sw/bin" \ "${BWRAP_ARGS[@]}" \ @@ -233,4 +234,5 @@ bwrap --unshare-all --share-net \ -e MICROVM_CLOSURE="$MICROVM_CLOSURE" \ -e MICROVM_UID="$MICROVM_UID" -e MICROVM_GID="$MICROVM_GID" \ -i -t -- "${MICROVM_COMMAND[@]}" \ - 13< /etc/resolv.conf + 13< /etc/resolv.conf \ + 14< /etc/localtime diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 3b229dd..15a5a08 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -64,6 +64,7 @@ in services.resolved.enable = false; environment.etc."resolv.conf".source = "/run/resolv.conf"; environment.etc."machine-id".source = "/run/machine-id"; + environment.etc."localtime".source = "/run/localtime"; environment.etc."systemd/system".source = lib.mkForce ( utils.systemdUtils.lib.generateUnits { type = "system";