Merge pull request #22264 from peterhoeg/m/modeswitch

usb-modeswitch: 2.2.1 -> 2.5.0 and nixos module
This commit is contained in:
Peter Hoeg 2017-02-21 16:49:04 +08:00 committed by GitHub
commit 8e5b630b49
4 changed files with 54 additions and 28 deletions

View file

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }:
with lib;
{
###### interface
options = {
hardware.usbWwan = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable this option to support USB WWAN adapters.
'';
};
};
};
###### implementation
config = mkIf config.hardware.usbWwan.enable {
services.udev.packages = with pkgs; [ usb-modeswitch-data ];
};
}

View file

@ -38,6 +38,7 @@
./hardware/network/rtl8192c.nix
./hardware/opengl.nix
./hardware/pcmcia.nix
./hardware/usb-wwan.nix
./hardware/video/amdgpu.nix
./hardware/video/amdgpu-pro.nix
./hardware/video/ati.nix

View file

@ -1,29 +1,27 @@
{ stdenv, fetchurl, pkgconfig, libusb1, usb-modeswitch }:
let
version = "20160112";
in
{ stdenv, fetchurl, pkgconfig, libusb1, tcl, usb-modeswitch }:
stdenv.mkDerivation rec {
name = "usb-modeswitch-data-${version}";
version = "20170205";
src = fetchurl {
url = "http://www.draisberghof.de/usb_modeswitch/${name}.tar.bz2";
sha256 = "19yzqv0592b9mwgdi7apzw881q70ajyx5d56zr1z5ldi915a8yfn";
};
url = "http://www.draisberghof.de/usb_modeswitch/${name}.tar.bz2";
sha256 = "1l9q4xk02zd0l50bqhyk906wbcs26ji7259q0f7qv3cj52fzvp72";
};
inherit (usb-modeswitch) makeFlags;
# make clean: we always build from source. It should be necessary on x86_64 only
prePatch = ''
sed -i 's@usb_modeswitch@${usb-modeswitch}/bin/usb_modeswitch@g' 40-usb_modeswitch.rules
sed -i "1 i\DESTDIR=$out" Makefile
'';
buildInputs = [ pkgconfig libusb1 usb-modeswitch ];
buildInputs = [ libusb1 usb-modeswitch ];
# we add tcl here so we can patch in support for new devices by dropping config into
# the usb_modeswitch.d directory
nativeBuildInputs = [ pkgconfig tcl ];
meta = {
meta = with stdenv.lib; {
description = "Device database and the rules file for 'multi-mode' USB devices";
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.marcweber ];
platforms = stdenv.lib.platforms.linux;
inherit (usb-modeswitch.meta) license maintainers platforms;
};
}

View file

@ -1,31 +1,32 @@
{ stdenv, fetchurl, pkgconfig, libusb1 }:
let
version = "2.3.0";
in
stdenv.mkDerivation rec {
name = "usb-modeswitch-${version}";
version = "2.5.0";
src = fetchurl {
url = "http://www.draisberghof.de/usb_modeswitch/${name}.tar.bz2";
sha256 = "1jqih1g0y78w03rchpw7fjvzwjfakak61qjp7hbr1m5nnsh2dn9p";
url = "http://www.draisberghof.de/usb_modeswitch/${name}.tar.bz2";
sha256 = "0cvnd16n2sp3w46fy507nl29q39jxxdk5qqbvk1rxaa91llbxh1i";
};
makeFlags = [
"DESTDIR=$(out)"
"PREFIX=$(out)"
];
# 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
mkdir -p $out/{etc,lib/udev,share/man/man1}
makeFlags="DESTDIR=$out PREFIX=$out"
'';
buildInputs = [ pkgconfig libusb1 ];
buildInputs = [ libusb1 ];
nativeBuildInputs = [ pkgconfig ];
meta = {
meta = with stdenv.lib; {
description = "A mode switching tool for controlling 'multi-mode' USB devices";
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.marcweber ];
platforms = stdenv.lib.platforms.linux;
license = licenses.gpl2;
maintainers = with maintainers; [ marcweber peterhoeg ];
platforms = platforms.linux;
};
}