summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlvar Penning <post@0x21.biz>2020-05-13 18:39:36 +0200
committerAlvar Penning <post@0x21.biz>2021-01-08 11:15:30 +0100
commitdc0552b0b7b304e4ff970dd3efd73ebb8381945c (patch)
tree76556182540f786c2ec6b0636d6d7fc81f571e45
parent623c10ac79fd8cca12d40f182bd1aed87388035d (diff)
downloadnixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar.gz
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar.bz2
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar.lz
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar.xz
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.tar.zst
nixpkgs-dc0552b0b7b304e4ff970dd3efd73ebb8381945c.zip
nixos/hardware/ubertooth: init at 2018-12-R1
-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; {