2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-06-18 23:15:34 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2012-06-18 23:15:34 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
# This unit saves the value of the system clock to the hardware
|
|
|
|
# clock on shutdown.
|
2013-11-26 17:17:12 +00:00
|
|
|
systemd.services.save-hwclock =
|
|
|
|
{ description = "Save Hardware Clock";
|
|
|
|
|
|
|
|
wantedBy = [ "shutdown.target" ];
|
|
|
|
|
|
|
|
unitConfig = {
|
|
|
|
DefaultDependencies = false;
|
2014-05-05 15:23:38 +01:00
|
|
|
ConditionPathExists = "/dev/rtc";
|
2013-11-26 17:17:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
2020-11-24 15:29:28 +00:00
|
|
|
ExecStart = "${pkgs.util-linux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}";
|
2013-11-26 17:17:12 +00:00
|
|
|
};
|
2012-06-18 23:15:34 +01:00
|
|
|
};
|
2012-08-14 21:45:50 +01:00
|
|
|
|
2013-03-27 16:20:41 +00:00
|
|
|
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";
|
|
|
|
|
2012-06-18 23:15:34 +01:00
|
|
|
}
|