nixpkgs/nixos/modules/programs/cdemu.nix

50 lines
1.1 KiB
Nix
Raw Normal View History

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 {
default = false;
2015-02-10 10:49:32 +00:00
description = "Whether to enable cdemu for users of appropriate group (default cdrom)";
2015-02-10 01:27:04 +00:00
};
group = mkOption {
default = "cdrom";
2015-02-10 10:49:32 +00:00
description = "Required group for users of cdemu";
2015-02-10 01:27:04 +00:00
};
gui = mkOption {
default = true;
2015-02-10 10:49:32 +00:00
description = "Whether to install cdemu GUI (gCDEmu)";
2015-02-10 01:27:04 +00:00
};
image-analyzer = mkOption {
default = true;
2015-02-10 10:49:32 +00:00
description = "Whether to install 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 = {
extraModulePackages = [ pkgs.linuxPackages.vhba ];
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
}