at 22.05-pre 1.4 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.programs.cdemu; 6in { 7 8 options = { 9 programs.cdemu = { 10 enable = mkOption { 11 type = types.bool; 12 default = false; 13 description = '' 14 <command>cdemu</command> for members of 15 <option>programs.cdemu.group</option>. 16 ''; 17 }; 18 group = mkOption { 19 type = types.str; 20 default = "cdrom"; 21 description = '' 22 Group that users must be in to use <command>cdemu</command>. 23 ''; 24 }; 25 gui = mkOption { 26 type = types.bool; 27 default = true; 28 description = '' 29 Whether to install the <command>cdemu</command> GUI (gCDEmu). 30 ''; 31 }; 32 image-analyzer = mkOption { 33 type = types.bool; 34 default = true; 35 description = '' 36 Whether to install the image analyzer. 37 ''; 38 }; 39 }; 40 }; 41 42 config = mkIf cfg.enable { 43 44 boot = { 45 extraModulePackages = [ config.boot.kernelPackages.vhba ]; 46 kernelModules = [ "vhba" ]; 47 }; 48 49 services = { 50 udev.extraRules = '' 51 KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="${cfg.group}" 52 ''; 53 dbus.packages = [ pkgs.cdemu-daemon ]; 54 }; 55 56 environment.systemPackages = 57 [ pkgs.cdemu-daemon pkgs.cdemu-client ] 58 ++ optional cfg.gui pkgs.gcdemu 59 ++ optional cfg.image-analyzer pkgs.image-analyzer; 60 }; 61 62}