Pass timezone through to the VM

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:<pipewireclock0> internal time 1:01:04.622699903
gstclock.c:1129:gst_clock_get_time:<pipewireclock0> 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
This commit is contained in:
Val Packett 2026-02-13 14:55:52 -03:00
parent 322b6efc1c
commit 8c3878f117
3 changed files with 6 additions and 1 deletions

View file

@ -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'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 resolv_conf = std::fs::read("/run/resolv.conf")?;
let localtime = std::fs::read("/run/localtime")?;
assert_eq!( assert_eq!(
unsafe { unsafe {
mount( mount(
@ -83,6 +84,7 @@ fn main() -> Result<(), std::io::Error> {
}, },
0 0
); );
std::fs::write("/run/localtime", &localtime)?;
std::fs::write("/run/resolv.conf", &resolv_conf)?; std::fs::write("/run/resolv.conf", &resolv_conf)?;
std::fs::write("/run/machine-id", &gen_machine_id())?; std::fs::write("/run/machine-id", &gen_machine_id())?;
std::os::unix::fs::symlink(&closure, "/run/current-system")?; std::os::unix::fs::symlink(&closure, "/run/current-system")?;

4
munix
View file

@ -223,6 +223,7 @@ bwrap --unshare-all --share-net \
--symlink "$MICROVM_CLOSURE" /run/current-system \ --symlink "$MICROVM_CLOSURE" /run/current-system \
--ro-bind /nix/store /nix/store \ --ro-bind /nix/store /nix/store \
--file 13 /run/resolv.conf \ --file 13 /run/resolv.conf \
--file 14 /run/localtime \
--dir "$XDG_RUNTIME_DIR" \ --dir "$XDG_RUNTIME_DIR" \
--setenv PATH "/run/munix/muvm:/run/munix/passt:$MICROVM_CLOSURE/sw/bin" \ --setenv PATH "/run/munix/muvm:/run/munix/passt:$MICROVM_CLOSURE/sw/bin" \
"${BWRAP_ARGS[@]}" \ "${BWRAP_ARGS[@]}" \
@ -233,4 +234,5 @@ bwrap --unshare-all --share-net \
-e MICROVM_CLOSURE="$MICROVM_CLOSURE" \ -e MICROVM_CLOSURE="$MICROVM_CLOSURE" \
-e MICROVM_UID="$MICROVM_UID" -e MICROVM_GID="$MICROVM_GID" \ -e MICROVM_UID="$MICROVM_UID" -e MICROVM_GID="$MICROVM_GID" \
-i -t -- "${MICROVM_COMMAND[@]}" \ -i -t -- "${MICROVM_COMMAND[@]}" \
13< /etc/resolv.conf 13< /etc/resolv.conf \
14< /etc/localtime

View file

@ -64,6 +64,7 @@ in
services.resolved.enable = false; services.resolved.enable = false;
environment.etc."resolv.conf".source = "/run/resolv.conf"; environment.etc."resolv.conf".source = "/run/resolv.conf";
environment.etc."machine-id".source = "/run/machine-id"; environment.etc."machine-id".source = "/run/machine-id";
environment.etc."localtime".source = "/run/localtime";
environment.etc."systemd/system".source = lib.mkForce ( environment.etc."systemd/system".source = lib.mkForce (
utils.systemdUtils.lib.generateUnits { utils.systemdUtils.lib.generateUnits {
type = "system"; type = "system";