···11+{ lib
22+, stdenv
33+, fetchFromGitHub
44+, libusb1
55+}:
66+77+stdenv.mkDerivation rec {
88+ pname = "usb-reset";
99+ # not tagged, but changelog has this with the date of the e9a9d6c commit
1010+ # and no significant change occured between bumping the version in the Makefile and that
1111+ # and the changes since then (up to ff822d8) seem snap related
1212+ version = "0.3";
1313+1414+ src = fetchFromGitHub {
1515+ owner = "ralight";
1616+ repo = pname;
1717+ rev = "e9a9d6c4a533430e763e111a349efbba69e7a5bb";
1818+ sha256 = "0k9qmhqi206gcnv3z4vwya82g5nm225972ylf67zjiikk8pn8m0s";
1919+ };
2020+2121+ buildInputs = [ libusb1 ];
2222+2323+ postPatch = ''
2424+ substituteInPlace Makefile \
2525+ --replace /usr/include/libusb-1.0 ${libusb1.dev}/include/libusb-1.0
2626+ '';
2727+2828+ makeFlags = [
2929+ "DESTDIR=${placeholder "out"}"
3030+ "prefix="
3131+ ];
3232+3333+ meta = with lib; {
3434+ description = "Perform a bus reset on a USB device using its vendor and product ID";
3535+ homepage = "https://github.com/ralight/usb-reset";
3636+ changelog = "https://github.com/ralight/usb-reset/blob/master/ChangeLog.txt";
3737+ license = licenses.mit;
3838+ maintainers = [ maintainers.evils ];
3939+ platforms = platforms.all;
4040+ };
4141+}