summary refs log tree commit diff
path: root/nixos/modules/hardware/ubertooth.nix
blob: 4b87abe5beb97eac91e67d6214970125afa41d33 (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
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.hardware.ubertooth;

  ubertoothPkg = pkgs.ubertooth.override {
    udevGroup = cfg.group;
  };
in {
  options.hardware.ubertooth = {
    enable = mkEnableOption (lib.mdDoc "Enable the Ubertooth software and its udev rules.");

    group = mkOption {
      type = types.str;
      default = "ubertooth";
      example = "wheel";
      description = lib.mdDoc "Group for Ubertooth's udev rules.";
    };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ ubertoothPkg ];

    services.udev.packages = [ ubertoothPkg ];
    users.groups.${cfg.group} = {};
  };
}