1{ config, lib, pkgs, ... }:
2
3let
4 cfg = config.hardware.hackrf;
5
6in
7{
8 options.hardware.hackrf = {
9 enable = lib.mkOption {
10 type = lib.types.bool;
11 default = false;
12 description = lib.mdDoc ''
13 Enables hackrf udev rules and ensures 'plugdev' group exists.
14 This is a prerequisite to using HackRF devices without being root, since HackRF USB descriptors will be owned by plugdev through udev.
15 '';
16 };
17 };
18
19 config = lib.mkIf cfg.enable {
20 services.udev.packages = [ pkgs.hackrf ];
21 users.groups.plugdev = { };
22 };
23}