From 9097b9e34a80bfa43bb6af5964f88fc65ac7ebf9 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Sat, 18 Feb 2017 11:35:02 +0800 Subject: [PATCH 1/3] usb-modeswitch: 2.2.1 -> 2.5.0 We were carrying v2.2.1 and not v2.3.0 due to the update only touching the version and not the sha256 sum. --- .../tools/misc/usb-modeswitch/default.nix | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkgs/development/tools/misc/usb-modeswitch/default.nix b/pkgs/development/tools/misc/usb-modeswitch/default.nix index 893df94d237..8a1ce7c0886 100644 --- a/pkgs/development/tools/misc/usb-modeswitch/default.nix +++ b/pkgs/development/tools/misc/usb-modeswitch/default.nix @@ -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; }; } From cad335eb0110ef9ff708d12da34d053b5fbddcb0 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Sat, 18 Feb 2017 11:35:25 +0800 Subject: [PATCH 2/3] usb-modeswitch-data: 20160112 -> 20170205 Plus some minor cleanups. --- .../tools/misc/usb-modeswitch/data.nix | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkgs/development/tools/misc/usb-modeswitch/data.nix b/pkgs/development/tools/misc/usb-modeswitch/data.nix index f543d3a475c..a45db5fbcaf 100644 --- a/pkgs/development/tools/misc/usb-modeswitch/data.nix +++ b/pkgs/development/tools/misc/usb-modeswitch/data.nix @@ -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; }; } From 0789a2a4d6d66a6c87308a596c61e5f34c81677c Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Sat, 18 Feb 2017 11:35:58 +0800 Subject: [PATCH 3/3] usb-wwan: nixos module --- nixos/modules/hardware/usb-wwan.nix | 26 ++++++++++++++++++++++++++ nixos/modules/module-list.nix | 1 + 2 files changed, 27 insertions(+) create mode 100644 nixos/modules/hardware/usb-wwan.nix diff --git a/nixos/modules/hardware/usb-wwan.nix b/nixos/modules/hardware/usb-wwan.nix new file mode 100644 index 00000000000..2d20421586a --- /dev/null +++ b/nixos/modules/hardware/usb-wwan.nix @@ -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 ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 81597d91d89..175ba182b4b 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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