nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 fetchurl,
4 tcl,
5 usb-modeswitch,
6 udevCheckHook,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "usb-modeswitch-data";
11 version = "20251207";
12
13 src = fetchurl {
14 url = "https://www.draisberghof.de/usb_modeswitch/${finalAttrs.pname}-${finalAttrs.version}.tar.bz2";
15 hash = "sha256-C7EtZK7l5GfDGvYaU/uCj/eqWcVKgsqF7u3kxWkL+mY=";
16 };
17
18 doInstallCheck = true;
19
20 makeFlags = [
21 "PREFIX=$(out)"
22 "DESTDIR=$(out)"
23 ];
24
25 postPatch =
26 # bash
27 ''
28 substituteInPlace 40-usb_modeswitch.rules \
29 --replace-fail "usb_modeswitch" "${usb-modeswitch}/lib/udev/usb_modeswitch"
30
31 # Fix issue reported by udevadm verify
32 sed -i 's/,,/,/g' 40-usb_modeswitch.rules
33 '';
34
35 # we add tcl here so we can patch in support for new devices by dropping config into
36 # the usb_modeswitch.d directory
37 nativeBuildInputs = [
38 tcl
39 udevCheckHook
40 ];
41
42 meta = {
43 description = "Device database and the rules file for 'multi-mode' USB devices";
44 inherit (usb-modeswitch.meta) license maintainers platforms;
45 };
46})