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