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