nixpkgs/nixos/modules/system/boot/shutdown.nix
Wolfgang Walther c283f32d29
treewide: remove unused with
Auto-fixed by nixf-diagnose.
2025-10-05 10:50:41 +02:00

34 lines
694 B
Nix

{
config,
lib,
pkgs,
...
}:
{
# 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";
ConditionPathIsReadWrite = "/etc/";
};
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.util-linux}/sbin/hwclock --systohc ${
if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"
}";
};
};
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";
}