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 eaf046b160f..9b722a576ce 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -67,6 +67,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 new file mode 100644 index 00000000000..fc9361971e7 --- /dev/null +++ b/pkgs/applications/radio/ubertooth/default.nix @@ -0,0 +1,34 @@ +{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libbtbb, libpcap , libusb1, bluez +, udevGroup ? "ubertooth" +}: + +stdenv.mkDerivation rec { + pname = "ubertooth"; + version = "2020-12-R1"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = pname; + rev = version; + sha256 = "11r5ag2l5xn4pr7ycicm30w9c3ldn9yiqj1sqnjc79csxl2vrcfw"; + }; + + sourceRoot = "source/host"; + + nativeBuildInputs = [ cmake pkgconfig ]; + buildInputs = [ libbtbb libpcap libusb1 bluez ]; + + cmakeFlags = lib.optionals stdenv.isLinux [ + "-DINSTALL_UDEV_RULES=TRUE" + "-DUDEV_RULES_PATH=etc/udev/rules.d" + "-DUDEV_RULES_GROUP=${udevGroup}" + ]; + + meta = with stdenv.lib; { + description = "Open source wireless development platform suitable for Bluetooth experimentation"; + homepage = "https://github.com/greatscottgadgets/ubertooth"; + license = licenses.gpl2; + maintainers = with maintainers; [ oxzi ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/libraries/libbtbb/default.nix b/pkgs/development/libraries/libbtbb/default.nix new file mode 100644 index 00000000000..72d842a55b5 --- /dev/null +++ b/pkgs/development/libraries/libbtbb/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "libbtbb"; + version = "2020-12-R1"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = pname; + rev = version; + sha256 = "1byv8174xam7siakr1p0523x97wkh0fmwmq341sd3g70qr2g767d"; + }; + + nativeBuildInputs = [ cmake ]; + + meta = with stdenv.lib; { + description = "Bluetooth baseband decoding library"; + homepage = "https://github.com/greatscottgadgets/libbtbb"; + license = licenses.gpl2; + maintainers = with maintainers; [ oxzi ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c740d0e156b..48f5f9fd016 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4422,6 +4422,8 @@ in libbladeRF = callPackage ../development/libraries/libbladeRF { }; + libbtbb = callPackage ../development/libraries/libbtbb { }; + lp_solve = callPackage ../applications/science/math/lp_solve { }; fastlane = callPackage ../tools/admin/fastlane { }; @@ -8852,6 +8854,8 @@ in ubridge = callPackage ../tools/networking/ubridge { }; + ubertooth = callPackage ../applications/radio/ubertooth { }; + ucl = callPackage ../development/libraries/ucl { }; ucspi-tcp = callPackage ../tools/networking/ucspi-tcp { };