ae4e94d9ac
Suggested by Mathijs Kwik. ‘boot.systemd’ is a misnomer because systemd affects more than just booting. And it saves some typing.
26 lines
565 B
Nix
26 lines
565 B
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
{
|
|
|
|
# This unit saves the value of the system clock to the hardware
|
|
# clock on shutdown.
|
|
systemd.units."save-hwclock.service" =
|
|
{ wantedBy = [ "shutdown.target" ];
|
|
|
|
text =
|
|
''
|
|
[Unit]
|
|
Description=Save Hardware Clock
|
|
DefaultDependencies=no
|
|
Before=shutdown.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}
|
|
'';
|
|
};
|
|
|
|
}
|