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-07-15 17:15:38 +00:00
|
|
|
version = "0.14.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libusb";
|
|
|
|
repo = "hidapi";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "hidapi-${finalAttrs.version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-p3uzBq5VxxQbVuy1lEHEEQdxXwnhQgJDIyAAWjVWNIg=";
|
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
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libusb1 udev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
propagatedBuildInputs = lib.optionals stdenv.hostPlatform.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 ] ;
|
2024-09-26 11:04:55 +00:00
|
|
|
pkgConfigModules = lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-02-16 17:41:37 +00:00
|
|
|
"hidapi"
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
2023-02-16 17:41:37 +00:00
|
|
|
"hidapi-hidraw"
|
|
|
|
"hidapi-libusb"
|
|
|
|
];
|
2024-07-27 06:49:29 +00:00
|
|
|
platforms = platforms.unix ++ platforms.windows;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-02-16 17:41:37 +00:00
|
|
|
})
|