nixpkgs/modules/system/boot/shutdown.nix
Eelco Dolstra 4475294f57 Fix a hang during shutdown
Subtle: dhcpcd.service would call resolvconf during shutdown, which in
turn would start invalidate-nscd.service, causing the shutdown to be
cancelled.  Instead, give nscd.service a proper reload action, and do
"systemctl reload --no-block nscd.service".  The --no-block is
necessary to prevent that command from waiting until a timeout occurs
(bug in systemd?).
2012-08-14 16:45:50 -04:00

26 lines
570 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
{
# This unit saves the value of the system clock to the hardware
# clock on shutdown.
boot.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"}
'';
};
}