2022-01-13 20:06:32 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, libusb1
|
|
|
|
, udev
|
|
|
|
, Cocoa
|
|
|
|
, IOKit
|
2023-02-16 17:41:37 +00:00
|
|
|
, testers
|
2022-01-13 20:06:32 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "hidapi";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "0.13.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libusb";
|
|
|
|
repo = "hidapi";
|
2023-02-16 17:41:37 +00:00
|
|
|
rev = "${finalAttrs.pname}-${finalAttrs.version}";
|
2023-03-04 12:14:45 +00:00
|
|
|
sha256 = "sha256-CEZP5n8qEAzsqn8dz3u1nG0YoT7J1P+WfN7urkRTuVg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ libusb1 udev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa IOKit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Library for communicating with USB and Bluetooth HID devices";
|
|
|
|
homepage = "https://github.com/libusb/hidapi";
|
2020-11-12 09:05:59 +00:00
|
|
|
maintainers = with maintainers; [ prusnak ];
|
2022-01-13 20:06:32 +00:00
|
|
|
# You can choose between GPLv3, BSD or HIDAPI license (even more liberal)
|
|
|
|
license = with licenses; [ bsd3 /* or */ gpl3Only ] ;
|
2023-02-16 17:41:37 +00:00
|
|
|
pkgConfigModules = lib.optionals stdenv.isDarwin [
|
|
|
|
"hidapi"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"hidapi-hidraw"
|
|
|
|
"hidapi-libusb"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2023-02-16 17:41:37 +00:00
|
|
|
})
|