| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 11:52:46 +01:00
										 |  |  | let cfg = config.programs.cdemu; | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  | in { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   options = { | 
					
						
							| 
									
										
										
										
											2015-02-10 11:52:46 +01:00
										 |  |  |     programs.cdemu = { | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       enable = mkOption { | 
					
						
							|  |  |  |         default = false; | 
					
						
							| 
									
										
										
										
											2015-09-07 00:47:18 +02:00
										 |  |  |         description = ''
 | 
					
						
							|  |  |  |           <command>cdemu</command> for members of | 
					
						
							|  |  |  |           <option>programs.cdemu.group</option>. | 
					
						
							|  |  |  |         '';
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |       group = mkOption { | 
					
						
							|  |  |  |         default = "cdrom"; | 
					
						
							| 
									
										
										
										
											2015-09-07 00:47:18 +02:00
										 |  |  |         description = ''
 | 
					
						
							|  |  |  |           Group that users must be in to use <command>cdemu</command>. | 
					
						
							|  |  |  |         '';
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |       gui = mkOption { | 
					
						
							|  |  |  |         default = true; | 
					
						
							| 
									
										
										
										
											2015-09-07 00:47:18 +02:00
										 |  |  |         description = ''
 | 
					
						
							|  |  |  |           Whether to install the <command>cdemu</command> GUI (gCDEmu). | 
					
						
							|  |  |  |         '';
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |       image-analyzer = mkOption { | 
					
						
							|  |  |  |         default = true; | 
					
						
							| 
									
										
										
										
											2015-09-07 00:47:18 +02:00
										 |  |  |         description = ''
 | 
					
						
							|  |  |  |           Whether to install the image analyzer. | 
					
						
							|  |  |  |         '';
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = mkIf cfg.enable { | 
					
						
							| 
									
										
										
										
											2015-02-10 11:49:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |     boot = { | 
					
						
							| 
									
										
										
										
											2016-01-07 19:15:01 +03:00
										 |  |  |       extraModulePackages = [ config.boot.kernelPackages.vhba ]; | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |       kernelModules = [ "vhba" ]; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2015-02-10 11:49:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |     services = { | 
					
						
							|  |  |  |       udev.extraRules = ''
 | 
					
						
							|  |  |  |         KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="${cfg.group}" | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |       dbus.packages = [ pkgs.cdemu-daemon ]; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2015-02-10 11:49:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  |     environment.systemPackages = | 
					
						
							|  |  |  |       [ pkgs.cdemu-daemon pkgs.cdemu-client ] | 
					
						
							|  |  |  |       ++ optional cfg.gui pkgs.gcdemu | 
					
						
							|  |  |  |       ++ optional cfg.image-analyzer pkgs.image-analyzer; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2015-02-10 11:49:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 02:27:04 +01:00
										 |  |  | } |