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