2022-08-12 12:06:08 +00:00
|
|
|
{ lib, stdenv, fetchpatch, fetchFromGitHub
|
2021-05-28 09:39:13 +00:00
|
|
|
, cmake, git
|
|
|
|
, asio, catch2, spdlog
|
|
|
|
, IOKit, udev
|
|
|
|
}:
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "pc-ble-driver";
|
2021-05-28 09:39:13 +00:00
|
|
|
version = "4.1.4";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NordicSemiconductor";
|
2022-09-30 11:47:45 +00:00
|
|
|
repo = pname;
|
2020-07-18 16:06:22 +00:00
|
|
|
rev = "v${version}";
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-srH7Gdiy9Lsv68fst/9jhifx03R2e+4kMia6pU/oCZg=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
2022-09-30 11:47:45 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "support-arm.patch";
|
|
|
|
url = "https://github.com/NordicSemiconductor/pc-ble-driver/commit/76a6b31dba7a13ceae40587494cbfa01a29192f4.patch";
|
|
|
|
hash = "sha256-bvK1BXjdlhIXV8R4PiCGaq8oSLzgjMmTgAwssm8N2sk=";
|
|
|
|
})
|
2022-08-12 12:06:08 +00:00
|
|
|
# Fix build with GCC 11
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/NordicSemiconductor/pc-ble-driver/commit/37258e65bdbcd0b4369ae448faf650dd181816ec.patch";
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-gOdzIW8YJQC+PE4FJd644I1+I7CMcBY8wpF6g02eI5g=";
|
2022-08-12 12:06:08 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DNRF_BLE_DRIVER_VERSION=${version}"
|
2022-09-30 11:47:45 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
"-DARCH=arm64"
|
2020-07-18 16:06:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake git ];
|
2021-05-28 09:39:13 +00:00
|
|
|
buildInputs = [ asio catch2 spdlog ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2020-08-20 17:08:02 +00:00
|
|
|
IOKit
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-08-20 17:08:02 +00:00
|
|
|
udev
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Desktop library for Bluetooth low energy development";
|
|
|
|
homepage = "https://github.com/NordicSemiconductor/pc-ble-driver";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|