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