2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
# This unit saves the value of the system clock to the hardware
|
|
|
|
# clock on shutdown.
|
|
|
|
systemd.services.save-hwclock =
|
|
|
|
{ description = "Save Hardware Clock";
|
|
|
|
|
|
|
|
wantedBy = [ "shutdown.target" ];
|
|
|
|
|
|
|
|
unitConfig = {
|
|
|
|
DefaultDependencies = false;
|
|
|
|
ConditionPathExists = "/dev/rtc";
|
|
|
|
};
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
2020-11-24 20:58:05 +00:00
|
|
|
ExecStart = "${pkgs.util-linux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";
|
|
|
|
|
|
|
|
}
|