1 { config, lib, pkgs, ... }:
5 let cfg = config.programs.cdemu;
13 description = lib.mdDoc ''
14 {command}`cdemu` for members of
15 {option}`programs.cdemu.group`.
21 description = lib.mdDoc ''
22 Group that users must be in to use {command}`cdemu`.
28 description = lib.mdDoc ''
29 Whether to install the {command}`cdemu` GUI (gCDEmu).
32 image-analyzer = mkOption {
35 description = lib.mdDoc ''
36 Whether to install the image analyzer.
42 config = mkIf cfg.enable {
45 extraModulePackages = [ config.boot.kernelPackages.vhba ];
46 kernelModules = [ "vhba" ];
51 KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="${cfg.group}"
53 dbus.packages = [ pkgs.cdemu-daemon ];
56 users.groups.${config.programs.cdemu.group} = {};
58 # Systemd User service
59 # manually adapted from example in source package:
60 # https://sourceforge.net/p/cdemu/code/ci/master/tree/cdemu-daemon/service-example/cdemu-daemon.service
61 systemd.user.services.cdemu-daemon.description = "CDEmu daemon";
62 systemd.user.services.cdemu-daemon.serviceConfig = {
64 BusName = "net.sf.cdemu.CDEmuDaemon";
65 ExecStart = "${pkgs.cdemu-daemon}/bin/cdemu-daemon --config-file \"%h/.config/cdemu-daemon\"";
69 environment.systemPackages =
70 [ pkgs.cdemu-daemon pkgs.cdemu-client ]
71 ++ optional cfg.gui pkgs.gcdemu
72 ++ optional cfg.image-analyzer pkgs.image-analyzer;