1 { config, lib, pkgs, ... }:
3 let cfg = config.programs.cdemu;
8 enable = lib.mkOption {
12 {command}`cdemu` for members of
13 {option}`programs.cdemu.group`.
16 group = lib.mkOption {
20 Group that users must be in to use {command}`cdemu`.
24 type = lib.types.bool;
27 Whether to install the {command}`cdemu` GUI (gCDEmu).
30 image-analyzer = lib.mkOption {
31 type = lib.types.bool;
34 Whether to install the image analyzer.
40 config = lib.mkIf cfg.enable {
43 extraModulePackages = [ config.boot.kernelPackages.vhba ];
44 kernelModules = [ "vhba" ];
49 KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="${cfg.group}"
51 dbus.packages = [ pkgs.cdemu-daemon ];
54 users.groups.${config.programs.cdemu.group} = {};
56 # Systemd User service
57 # manually adapted from example in source package:
58 # https://sourceforge.net/p/cdemu/code/ci/master/tree/cdemu-daemon/service-example/cdemu-daemon.service
59 systemd.user.services.cdemu-daemon.description = "CDEmu daemon";
60 systemd.user.services.cdemu-daemon.serviceConfig = {
62 BusName = "net.sf.cdemu.CDEmuDaemon";
63 ExecStart = "${lib.getExe pkgs.cdemu-daemon} --config-file \"%h/.config/cdemu-daemon\"";
67 environment.systemPackages =
68 [ pkgs.cdemu-daemon pkgs.cdemu-client ]
69 ++ lib.optional cfg.gui pkgs.gcdemu
70 ++ lib.optional cfg.image-analyzer pkgs.image-analyzer;