| 
									
										
										
										
											2014-04-14 16:26:48 +02:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							| 
									
										
										
										
											2012-06-18 18:15:34 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-14 16:26:48 +02:00
										 |  |  | with lib; | 
					
						
							| 
									
										
										
										
											2012-06-18 18:15:34 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   # This unit saves the value of the system clock to the hardware | 
					
						
							|  |  |  |   # clock on shutdown. | 
					
						
							| 
									
										
										
										
											2013-11-26 18:17:12 +01:00
										 |  |  |   systemd.services.save-hwclock = | 
					
						
							|  |  |  |     { description = "Save Hardware Clock"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       wantedBy = [ "shutdown.target" ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       unitConfig = { | 
					
						
							|  |  |  |         DefaultDependencies = false; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:23:38 +02:00
										 |  |  |         ConditionPathExists = "/dev/rtc"; | 
					
						
							| 
									
										
										
										
											2013-11-26 18:17:12 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       serviceConfig = { | 
					
						
							|  |  |  |         Type = "oneshot"; | 
					
						
							|  |  |  |         ExecStart = "${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}"; | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2012-06-18 18:15:34 -04:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2012-08-14 16:45:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-27 17:20:41 +01:00
										 |  |  |   boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-18 18:15:34 -04:00
										 |  |  | } |