Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 autoreconfHook, 6 pkg-config, 7 libusb1, 8}: 9 10stdenv.mkDerivation rec { 11 pname = "libusb-compat"; 12 version = "0.1.8"; 13 14 outputs = [ 15 "out" 16 "dev" 17 ]; # get rid of propagating systemd closure 18 outputBin = "dev"; 19 20 src = fetchFromGitHub { 21 owner = "libusb"; 22 repo = "libusb-compat-0.1"; 23 rev = "v${version}"; 24 sha256 = "sha256-pAPERYSxoc47gwpPUoMkrbK8TOXyx03939vlFN0hHRg="; 25 }; 26 27 patches = lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch; 28 29 nativeBuildInputs = [ 30 autoreconfHook 31 pkg-config 32 ]; 33 34 buildInputs = [ libusb1 ]; 35 36 # without this, libusb-compat is unable to find libusb1 37 postFixup = '' 38 find $out/lib -name \*.so\* -type f -exec \ 39 patchelf --set-rpath ${lib.makeLibraryPath buildInputs} {} \; 40 ''; 41 42 meta = with lib; { 43 homepage = "https://libusb.info/"; 44 description = "Cross-platform user-mode USB device library"; 45 mainProgram = "libusb-config"; 46 longDescription = '' 47 libusb is a cross-platform user-mode library that provides access to USB devices. 48 The current API is of 1.0 version (libusb-1.0 API), this library is a wrapper exposing the legacy API. 49 ''; 50 license = licenses.lgpl2Plus; 51 platforms = platforms.unix; 52 }; 53}