nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, libusb1
7, udev
8, Cocoa
9, IOKit
10}:
11
12stdenv.mkDerivation rec {
13 pname = "hidapi";
14 version = "0.11.2";
15
16 src = fetchFromGitHub {
17 owner = "libusb";
18 repo = "hidapi";
19 rev = "${pname}-${version}";
20 sha256 = "sha256-zSAhnvnDI3+q8VwZ8fIx/YmvwTpL87PBJ2C1mTmD7Ko=";
21 };
22
23 nativeBuildInputs = [ cmake pkg-config ];
24
25 buildInputs = lib.optionals stdenv.isLinux [ libusb1 udev ];
26
27 enableParallelBuilding = true;
28
29 propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa IOKit ];
30
31 meta = with lib; {
32 description = "Library for communicating with USB and Bluetooth HID devices";
33 homepage = "https://github.com/libusb/hidapi";
34 maintainers = with maintainers; [ prusnak ];
35 # You can choose between GPLv3, BSD or HIDAPI license (even more liberal)
36 license = with licenses; [ bsd3 /* or */ gpl3Only ] ;
37 platforms = platforms.unix;
38 };
39}