about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/audio/goxlr-utility.nix
blob: c047dbb221b168e973205451bb91d0170f77b370 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ config, lib, pkgs, ... }:

let
  cfg = config.services.goxlr-utility;
in

with lib;
{

  options = {
    services.goxlr-utility = {
      enable = mkOption {
        default = false;
        type = types.bool;
        description = lib.mdDoc ''
          Whether to enable goxlr-utility for controlling your TC-Helicon GoXLR or GoXLR Mini
        '';
      };
      package = mkPackageOption pkgs "goxlr-utility" { };
      autoStart.xdg = mkOption {
        default = true;
        type = with types; bool;
        description = lib.mdDoc ''
          Start the daemon automatically using XDG autostart.
          Sets `xdg.autostart.enable = true` if not already enabled.
        '';
      };
    };
  };

  config = mkIf config.services.goxlr-utility.enable
    {
      services.udev.packages = [ cfg.package ];

      xdg.autostart.enable = mkIf cfg.autoStart.xdg true;
      environment.systemPackages = mkIf cfg.autoStart.xdg
        [
          cfg.package
          (pkgs.makeAutostartItem
            {
              name = "goxlr-utility";
              package = cfg.package;
            })
        ];
    };

  meta.maintainers = with maintainers; [ errnoh ];
}