nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, fetchFromGitHub
3, autoreconfHook
4, pkgconfig
5, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isMusl
6, systemd ? null
7, libobjc
8, IOKit
9, withStatic ? false
10}:
11
12assert enableSystemd -> systemd != null;
13
14stdenv.mkDerivation rec {
15 pname = "libusb";
16 version = "1.0.23";
17
18 src = fetchFromGitHub {
19 owner = "libusb";
20 repo = "libusb";
21 rev = "v${version}";
22 sha256 = "0mxbpg01kgbk5nh6524b0m4xk7ywkyzmc3yhi5asqcsd3rbhjj98";
23 };
24
25 outputs = [ "out" "dev" ];
26
27 nativeBuildInputs = [ pkgconfig autoreconfHook ];
28 propagatedBuildInputs =
29 stdenv.lib.optional enableSystemd systemd ++
30 stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
31
32 dontDisableStatic = withStatic;
33
34 configureFlags = stdenv.lib.optional (!enableSystemd) "--disable-udev";
35
36 preFixup = stdenv.lib.optionalString enableSystemd ''
37 sed 's,-ludev,-L${stdenv.lib.getLib systemd}/lib -ludev,' -i $out/lib/libusb-1.0.la
38 '';
39
40 meta = with stdenv.lib; {
41 homepage = "https://libusb.info/";
42 repositories.git = "https://github.com/libusb/libusb";
43 description = "cross-platform user-mode USB device library";
44 longDescription = ''
45 libusb is a cross-platform user-mode library that provides access to USB devices.
46 '';
47 platforms = platforms.all;
48 license = licenses.lgpl21Plus;
49 maintainers = [ ];
50 };
51}