mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 15:36:47 +03:00
5bfe944907
E.g. on EC2 instances. Backport: 14.04
28 lines
658 B
Nix
28 lines
658 B
Nix
{ 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";
|
|
ExecStart = "${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}";
|
|
};
|
|
};
|
|
|
|
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";
|
|
|
|
}
|