summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/hardware/ubertooth.nix29
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--pkgs/applications/radio/ubertooth/default.nix6
3 files changed, 34 insertions, 2 deletions
diff --git a/nixos/modules/hardware/ubertooth.nix b/nixos/modules/hardware/ubertooth.nix
new file mode 100644
index 00000000000..637fddfb37d
--- /dev/null
+++ b/nixos/modules/hardware/ubertooth.nix
@@ -0,0 +1,29 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.hardware.ubertooth;
+
+  ubertoothPkg = pkgs.ubertooth.override {
+    udevGroup = cfg.group;
+  };
+in {
+  options.hardware.ubertooth = {
+    enable = mkEnableOption "Enable the Ubertooth software and its udev rules.";
+
+    group = mkOption {
+      type = types.str;
+      default = "ubertooth";
+      example = "wheel";
+      description = "Group for Ubertooth's udev rules.";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.systemPackages = [ ubertoothPkg ];
+
+    services.udev.packages = [ ubertoothPkg ];
+    users.groups.${cfg.group} = {};
+  };
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 8fd5d4519fd..40665fc1b3e 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -64,6 +64,7 @@
   ./hardware/steam-hardware.nix
   ./hardware/system-76.nix
   ./hardware/tuxedo-keyboard.nix
+  ./hardware/ubertooth.nix
   ./hardware/usb-wwan.nix
   ./hardware/onlykey.nix
   ./hardware/opentabletdriver.nix
diff --git a/pkgs/applications/radio/ubertooth/default.nix b/pkgs/applications/radio/ubertooth/default.nix
index f9626ea4c36..2ea240618c7 100644
--- a/pkgs/applications/radio/ubertooth/default.nix
+++ b/pkgs/applications/radio/ubertooth/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libbtbb, libpcap , libusb1, bluez }:
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libbtbb, libpcap , libusb1, bluez
+, udevGroup ? "ubertooth"
+}:
 
 stdenv.mkDerivation rec {
   pname = "ubertooth";
@@ -19,7 +21,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = lib.optionals stdenv.isLinux [
     "-DINSTALL_UDEV_RULES=TRUE"
     "-DUDEV_RULES_PATH=etc/udev/rules.d"
-    "-DUDEV_RULES_GROUP=ubertooth"
+    "-DUDEV_RULES_GROUP=${udevGroup}"
   ];
 
   meta = with stdenv.lib; {