summary refs log tree commit diff
path: root/pkgs/development/tools/misc/usb-modeswitch/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-26 22:39:25 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-26 22:39:25 +0000
commitbd2ad77e38991af0d7a3a5d82bd3f41a077ce401 (patch)
treed1e26d039eb5004eb7c836aafff259cc198626d4 /pkgs/development/tools/misc/usb-modeswitch/default.nix
parente5d8381542a8d084371d26013fab199f52474be7 (diff)
parentad3f0d9829119b611350a9be1c226fb625f1f310 (diff)
downloadnixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar.gz
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar.bz2
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar.lz
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar.xz
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.tar.zst
nixpkgs-bd2ad77e38991af0d7a3a5d82bd3f41a077ce401.zip
Merge remote-tracking branch 'nixpkgs/master' into master
Diffstat (limited to 'pkgs/development/tools/misc/usb-modeswitch/default.nix')
-rw-r--r--pkgs/development/tools/misc/usb-modeswitch/default.nix30
1 files changed, 22 insertions, 8 deletions
diff --git a/pkgs/development/tools/misc/usb-modeswitch/default.nix b/pkgs/development/tools/misc/usb-modeswitch/default.nix
index a0e1b8eb8ce..731ac836412 100644
--- a/pkgs/development/tools/misc/usb-modeswitch/default.nix
+++ b/pkgs/development/tools/misc/usb-modeswitch/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, libusb1 }:
+{ stdenv, lib, fetchurl, pkgconfig, makeWrapper
+, libusb1, tcl, utillinux, coreutils, bash }:
 
 stdenv.mkDerivation rec {
   pname = "usb-modeswitch";
@@ -9,19 +10,32 @@ stdenv.mkDerivation rec {
     sha256 = "18wbbxc5cfsmikba0msdvd5qlaga27b32nhrzicyd9mdddp265f2";
   };
 
+  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 = [
-    "DESTDIR=$(out)"
     "PREFIX=$(out)"
+    "ETCDIR=/etc"
+    "USE_UPSTART=false"
+    "USE_SYSTEMD=true"
+    "SYSDIR=$(out)/lib/systemd/system"
+    "UDEVDIR=$(out)/lib/udev"
   ];
 
-  # make clean: we always build from source. It should be necessary on x86_64 only
-  preConfigure = ''
-    find -type f | xargs sed 's@/bin/rm@rm@g' -i
-    make clean
+  postFixup = ''
+    wrapProgram $out/bin/usb_modeswitch_dispatcher \
+      --set PATH ${lib.makeBinPath [ utillinux coreutils bash ]}
   '';
 
-  buildInputs = [ libusb1 ];
-  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libusb1 tcl ];
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
 
   meta = with stdenv.lib; {
     description = "A mode switching tool for controlling 'multi-mode' USB devices";