| 
									
										
										
										
											2014-04-14 16:26:48 +02:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							| 
									
										
										
										
											2012-03-20 04:41:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-14 16:26:48 +02:00
										 |  |  | with lib; | 
					
						
							| 
									
										
										
										
											2012-03-20 04:41:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-18 16:12:36 +02:00
										 |  |  |   options = { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     services.hardware.pommed = { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       enable = mkOption { | 
					
						
							|  |  |  |         type = types.bool; | 
					
						
							|  |  |  |         default = false; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           Whether to use the pommed tool to handle Apple laptop keyboard hotkeys. | 
					
						
							|  |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       configFile = mkOption { | 
					
						
							|  |  |  |         type = types.path; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           The path to the <filename>pommed.conf</filename> file. | 
					
						
							|  |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2012-03-20 04:41:13 +00:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = mkIf config.services.hardware.pommed.enable { | 
					
						
							|  |  |  |     environment.systemPackages = [ pkgs.polkit ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-18 16:12:36 +02:00
										 |  |  |     environment.etc."pommed.conf".source = config.services.hardware.pommed.configFile; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     services.hardware.pommed.configFile = "${pkgs.pommed}/etc/pommed.conf"; | 
					
						
							| 
									
										
										
										
											2012-03-20 04:41:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     services.dbus.packages = [ pkgs.pommed ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     jobs.pommed = { name = "pommed"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       description = "Pommed hotkey management"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       startOn = "started dbus"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       postStop = "rm -f /var/run/pommed.pid"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       exec = "${pkgs.pommed}/bin/pommed"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       daemonType = "fork"; | 
					
						
							| 
									
										
										
										
											2012-03-20 18:28:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       path = [ pkgs.eject ]; | 
					
						
							| 
									
										
										
										
											2012-03-20 04:41:13 +00:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |