Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / pc-ble-driver / default.nix
blob7a7b8475d7c462f769e6631e38863b89a906b735
1 { lib, stdenv, fetchpatch, fetchFromGitHub
2 , cmake, git
3 , asio, catch2, spdlog
4 , IOKit, udev
5 }:
7 stdenv.mkDerivation rec {
8   pname = "pc-ble-driver";
9   version = "4.1.4";
11   src = fetchFromGitHub {
12     owner = "NordicSemiconductor";
13     repo = pname;
14     rev = "v${version}";
15     hash = "sha256-srH7Gdiy9Lsv68fst/9jhifx03R2e+4kMia6pU/oCZg=";
16   };
18   patches = [
19     (fetchpatch {
20       name = "support-arm.patch";
21       url = "https://github.com/NordicSemiconductor/pc-ble-driver/commit/76a6b31dba7a13ceae40587494cbfa01a29192f4.patch";
22       hash = "sha256-bvK1BXjdlhIXV8R4PiCGaq8oSLzgjMmTgAwssm8N2sk=";
23     })
24      # Fix build with GCC 11
25     (fetchpatch {
26       url = "https://github.com/NordicSemiconductor/pc-ble-driver/commit/37258e65bdbcd0b4369ae448faf650dd181816ec.patch";
27       hash = "sha256-gOdzIW8YJQC+PE4FJd644I1+I7CMcBY8wpF6g02eI5g=";
28     })
29   ];
31   cmakeFlags = [
32     "-DNRF_BLE_DRIVER_VERSION=${version}"
33   ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
34     "-DARCH=arm64"
35   ];
37   nativeBuildInputs = [ cmake git ];
38   buildInputs = [ asio catch2 spdlog ];
40   propagatedBuildInputs = [
42   ] ++ lib.optionals stdenv.isDarwin [
43     IOKit
44   ] ++ lib.optionals stdenv.isLinux [
45     udev
46   ];
48   meta = with lib; {
49     description = "Desktop library for Bluetooth low energy development";
50     homepage = "https://github.com/NordicSemiconductor/pc-ble-driver";
51     license = licenses.unfreeRedistributable;
52     platforms = platforms.unix;
53   };