From 7d8fea797a4a844c6715a4f8a0a70f86df96bf5a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Mar 2014 23:14:34 +0100 Subject: [PATCH] Run hwclock --hctosys to initialize the system time --- nixos/modules/system/boot/kernel.nix | 3 +++ nixos/modules/system/boot/stage-2-init.sh | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 327f3b7e112..4cfd8a0b618 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -203,6 +203,9 @@ in # To wait for SCSI devices to appear. "scsi_wait_scan" + + # Needed by the stage 2 init script. + "rtc_cmos" ]; boot.initrd.kernelModules = diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh index 9b3cfc9e7a5..4a86daf1fe8 100644 --- a/nixos/modules/system/boot/stage-2-init.sh +++ b/nixos/modules/system/boot/stage-2-init.sh @@ -161,6 +161,12 @@ echo "running activation script..." $systemConfig/activate +# Restore the system time from the hardware clock. We do this after +# running the activation script to be sure that /etc/localtime points +# at the current time zone. +hwclock --hctosys + + # Record the boot configuration. ln -sfn "$systemConfig" /run/booted-system