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";