1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libusb1,
6}:
7
8stdenv.mkDerivation {
9 pname = "usb-reset";
10 # not tagged, but changelog has this with the date of the e9a9d6c commit
11 # and no significant change occurred between bumping the version in the Makefile and that
12 # and the changes since then (up to ff822d8) seem snap related
13 version = "0.3";
14
15 src = fetchFromGitHub {
16 owner = "ralight";
17 repo = "usb-reset";
18 rev = "e9a9d6c4a533430e763e111a349efbba69e7a5bb";
19 sha256 = "0k9qmhqi206gcnv3z4vwya82g5nm225972ylf67zjiikk8pn8m0s";
20 };
21
22 buildInputs = [ libusb1 ];
23
24 postPatch = ''
25 substituteInPlace Makefile \
26 --replace /usr/include/libusb-1.0 ${libusb1.dev}/include/libusb-1.0
27 '';
28
29 makeFlags = [
30 "DESTDIR=${placeholder "out"}"
31 "prefix="
32 ];
33
34 meta = with lib; {
35 broken = stdenv.hostPlatform.isDarwin;
36 description = "Perform a bus reset on a USB device using its vendor and product ID";
37 homepage = "https://github.com/ralight/usb-reset";
38 changelog = "https://github.com/ralight/usb-reset/blob/master/ChangeLog.txt";
39 license = licenses.mit;
40 maintainers = [ maintainers.evils ];
41 platforms = platforms.all;
42 mainProgram = "usb-reset";
43 };
44}