1{ config, lib, pkgs, ... }:
2
3let
4 cfg = config.services.goxlr-utility;
5in
6
7with lib;
8{
9
10 options = {
11 services.goxlr-utility = {
12 enable = mkOption {
13 default = false;
14 type = types.bool;
15 description = lib.mdDoc ''
16 Whether to enable goxlr-utility for controlling your TC-Helicon GoXLR or GoXLR Mini
17 '';
18 };
19 package = mkPackageOptionMD pkgs "goxlr-utility" { };
20 autoStart.xdg = mkOption {
21 default = true;
22 type = with types; bool;
23 description = lib.mdDoc ''
24 Start the daemon automatically using XDG autostart.
25 Sets `xdg.autostart.enable = true` if not already enabled.
26 '';
27 };
28 };
29 };
30
31 config = mkIf config.services.goxlr-utility.enable
32 {
33 services.udev.packages = [ cfg.package ];
34
35 xdg.autostart.enable = mkIf cfg.autoStart.xdg true;
36 environment.systemPackages = mkIf cfg.autoStart.xdg
37 [
38 cfg.package
39 (pkgs.makeAutostartItem
40 {
41 name = "goxlr-utility";
42 package = cfg.package;
43 })
44 ];
45 };
46
47 meta.maintainers = with maintainers; [ errnoh ];
48}