summary refs log tree commit diff
path: root/nixos/modules/virtualisation/qemu-vm.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-28 16:52:08 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-28 16:52:08 +0100
commitc704f6bb4e884c5c5670f08dd3f5daedd18d5772 (patch)
treeff6c8880cbcf0afe0afd81220d3f4d1f6f6e7ffd /nixos/modules/virtualisation/qemu-vm.nix
parent98c3caed931c5942bf17b5fea863f37d1711c1e1 (diff)
downloadnixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar.gz
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar.bz2
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar.lz
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar.xz
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.tar.zst
nixlib-c704f6bb4e884c5c5670f08dd3f5daedd18d5772.zip
VM tests: Run hwclock in the initrd
Needed for the installer tests, since otherwise mounting a filesystem
may fail as it has a last-mounted date in the future.

http://hydra.nixos.org/build/9846712
Diffstat (limited to 'nixos/modules/virtualisation/qemu-vm.nix')
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index a866b513f0f2..80bc71bbb8c6 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -291,6 +291,11 @@ in
         if test -z "$FSTYPE"; then
             mke2fs -t ext4 /dev/vda
         fi
+
+        # Set the system time from the hardware clock to work around a
+        # bug in qemu-kvm > 1.5.2 (where the VM clock is initialised
+        # to the *boot time* of the host).
+        hwclock -s
       '';
 
     boot.initrd.postMountCommands =