diff options
author | Ivan Jager <aij+git@mrph.org> | 2021-12-27 15:37:32 -0600 |
---|---|---|
committer | Ivan Jager <aij+git@mrph.org> | 2021-12-31 10:24:49 -0600 |
commit | ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba (patch) | |
tree | 40fa0f6d7e93b818602128a71a2949e55136471a | |
parent | 87a43a4b2212bbf071a20a11b61f030a12f3ab4c (diff) | |
download | nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar.gz nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar.bz2 nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar.lz nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar.xz nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.tar.zst nixpkgs-ca0fbf9739e0b214b7e3f74c1bdfa4d258b827ba.zip |
nixos/hardware/hackrf: new module
This is a very this module to enable the hackrf udev rules and ensure the "plugdev" group they use exists.
-rw-r--r-- | nixos/modules/hardware/hackrf.nix | 23 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/hardware/hackrf.nix b/nixos/modules/hardware/hackrf.nix new file mode 100644 index 00000000000..7f03b765bbd --- /dev/null +++ b/nixos/modules/hardware/hackrf.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.hardware.hackrf; + +in +{ + options.hardware.hackrf = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enables hackrf udev rules and ensures 'plugdev' group exists. + This is a prerequisite to using HackRF devices without being root, since HackRF USB descriptors will be owned by plugdev through udev. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + services.udev.packages = [ pkgs.hackrf ]; + users.groups.plugdev = { }; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 30ad0db459e..de270a149ee 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -53,6 +53,7 @@ ./hardware/flirc.nix ./hardware/gpgsmartcards.nix ./hardware/i2c.nix + ./hardware/hackrf.nix ./hardware/sensor/hddtemp.nix ./hardware/sensor/iio.nix ./hardware/keyboard/teck.nix |