1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-14 16:46:09 +00:00
nixpkgs/pkgs/development/tools/misc/usb-modeswitch/default.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

2019-05-05 09:23:32 +01:00
{ stdenv, lib, fetchurl, pkgconfig, makeWrapper
, libusb1, tcl, utillinux, coreutils, bash }:
2014-07-18 17:11:16 +01:00
stdenv.mkDerivation rec {
pname = "usb-modeswitch";
2019-12-09 23:27:53 +00:00
version = "2.6.0";
2015-02-17 00:33:28 +00:00
src = fetchurl {
url = "http://www.draisberghof.de/usb_modeswitch/${pname}-${version}.tar.bz2";
2019-12-09 23:27:53 +00:00
sha256 = "18wbbxc5cfsmikba0msdvd5qlaga27b32nhrzicyd9mdddp265f2";
};
2019-05-05 09:23:32 +01:00
patches = [ ./configurable-usb-modeswitch.patch ];
# Remove attempts to write to /etc and /var/lib.
postPatch = ''
sed -i \
-e '/^\tinstall .* usb_modeswitch.conf/s,$(ETCDIR),$(out)/etc,' \
-e '\,^\tinstall -d .*/var/lib/usb_modeswitch,d' \
Makefile
'';
makeFlags = [
"PREFIX=$(out)"
2019-05-05 09:23:32 +01:00
"ETCDIR=/etc"
"USE_UPSTART=false"
"USE_SYSTEMD=true"
"SYSDIR=$(out)/lib/systemd/system"
"UDEVDIR=$(out)/lib/udev"
];
2019-05-05 09:23:32 +01:00
postFixup = ''
wrapProgram $out/bin/usb_modeswitch_dispatcher \
--set PATH ${lib.makeBinPath [ utillinux coreutils bash ]}
'';
2019-05-05 09:23:32 +01:00
buildInputs = [ libusb1 tcl ];
nativeBuildInputs = [ pkgconfig makeWrapper ];
meta = with stdenv.lib; {
description = "A mode switching tool for controlling 'multi-mode' USB devices";
license = licenses.gpl2;
maintainers = with maintainers; [ marcweber peterhoeg ];
platforms = platforms.linux;
};
}