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