Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 libusb1, 8 udev, 9 testers, 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "hidapi"; 14 version = "0.15.0"; 15 16 src = fetchFromGitHub { 17 owner = "libusb"; 18 repo = "hidapi"; 19 rev = "hidapi-${finalAttrs.version}"; 20 sha256 = "sha256-o6IZRG42kTa7EQib9eaV1HGyjaGgeCabk+8fyQTm/0s="; 21 }; 22 23 nativeBuildInputs = [ 24 cmake 25 pkg-config 26 ]; 27 28 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 29 libusb1 30 udev 31 ]; 32 33 enableParallelBuilding = true; 34 35 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 36 37 meta = with lib; { 38 description = "Library for communicating with USB and Bluetooth HID devices"; 39 homepage = "https://github.com/libusb/hidapi"; 40 maintainers = with maintainers; [ prusnak ]; 41 # You can choose between GPLv3, BSD or HIDAPI license (even more liberal) 42 license = with licenses; [ 43 bsd3 # or 44 gpl3Only 45 ]; 46 pkgConfigModules = 47 lib.optionals stdenv.hostPlatform.isDarwin [ 48 "hidapi" 49 ] 50 ++ lib.optionals stdenv.hostPlatform.isLinux [ 51 "hidapi-hidraw" 52 "hidapi-libusb" 53 ]; 54 platforms = platforms.unix ++ platforms.windows; 55 }; 56})