about summary refs log tree commit diff
path: root/pkgs/misc/drivers
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-10-03 13:33:13 +0200
committerVladimír Čunát <vcunat@gmail.com>2015-10-03 13:33:37 +0200
commit5227fb1dd53fcb5918b9342dff4868f4ad68427e (patch)
treed6cd521e3f67944031216a27f740f28f22b73b41 /pkgs/misc/drivers
parentd6dd3b8bd1eaeeb21dfdb5051cd4732c748ce5d7 (diff)
parent33373d939a19f465228ddede6d38ce9032b5916b (diff)
downloadnixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.gz
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.bz2
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.lz
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.xz
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.zst
nixlib-5227fb1dd53fcb5918b9342dff4868f4ad68427e.zip
Merge commit staging+systemd into closure-size
Many non-conflict problems weren't (fully) resolved in this commit yet.
Diffstat (limited to 'pkgs/misc/drivers')
-rw-r--r--pkgs/misc/drivers/hplip/default.nix131
-rw-r--r--pkgs/misc/drivers/sundtek/default.nix48
-rw-r--r--pkgs/misc/drivers/xwiimote/default.nix4
3 files changed, 137 insertions, 46 deletions
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix
index b40aab73a4d1..28ae8b25ca73 100644
--- a/pkgs/misc/drivers/hplip/default.nix
+++ b/pkgs/misc/drivers/hplip/default.nix
@@ -1,44 +1,78 @@
 { stdenv, fetchurl, automake, pkgconfig
-, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus
-, polkit, qtSupport ? true, qt4, pythonDBus, pyqt4, net_snmp
-, withPlugin ? false, substituteAll
+, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus, usbutils
+, polkit, qtSupport ? true, qt4, pyqt4, net_snmp
+, withPlugin ? false, substituteAll, makeWrapper
 }:
 
 let
 
-  name = "hplip-3.15.2";
+  version = "3.15.9";
+
+  name = "hplip-${version}";
 
   src = fetchurl {
     url = "mirror://sourceforge/hplip/${name}.tar.gz";
-    sha256 = "0z7n62vdbr0p0kls1m2sr3nhvkhx3rawcbzd0zdl0lnq8fkyq0jz";
+    sha256 = "0vcxz3gsqcamlzx61xm77h7c769ya8kdhzwafa9w2wvkf3l8zxd1";
+  };
+
+  plugin = fetchurl {
+    url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+    sha256 = "1ahalw83xm8x0h6hljhnkknry1hny9flkrlzcymv8nmwgic0kjgs";
   };
 
   hplip_state =
     substituteAll
       {
+        inherit version;
         src = ./hplip.state;
-        # evaluated this way, version is always up-to-date
-        version = (builtins.parseDrvName name).version;
       };
 
-  plugin = fetchurl {
-    url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
-    sha256 = "0j8z8m3ygwahka7jv3hpzvfz187lh3kzzjhcy7grgaw2k01v5frm";
-  };
+  hplip_arch =
+    {
+      "i686-linux" = "x86_32";
+      "x86_64-linux" = "x86_64";
+      "arm6l-linux" = "arm32";
+      "arm7l-linux" = "arm32";
+    }."${stdenv.system}" or (abort "Unsupported platform ${stdenv.system}");
 
 in
 
 stdenv.mkDerivation {
   inherit name src;
 
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    pythonPackages.python
+    pythonPackages.wrapPython
+    saneBackends
+    dbus
+    net_snmp
+  ] ++ stdenv.lib.optional qtSupport qt4;
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  pythonPath = with pythonPackages; [
+    dbus
+    pillow
+    pygobject
+    recursivePthLoader
+    reportlab
+    usbutils
+  ] ++ stdenv.lib.optional qtSupport pyqt4;
+
   prePatch = ''
     # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
-    find . -type f -exec sed -i s,/etc/hp,$out/etc/hp, {} \;
-    find . -type f -exec sed -i s,/etc/sane.d,$out/etc/sane.d, {} \;
-    find . -type f -exec sed -i s,/usr/include/libusb-1.0,${libusb1}/include/libusb-1.0, {} \;
-    find . -type f -exec sed -i s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor, {} \;
-    find . -type f -exec sed -i s,/usr/lib/systemd/system,$out/lib/systemd/system, {} \;
-    find . -type f -exec sed -i s,/var/lib/hp,$out/var/lib/hp, {} \;
+    find . -type f -exec sed -i \
+      -e s,/etc/hp,$out/etc/hp, \
+      -e s,/etc/sane.d,$out/etc/sane.d, \
+      -e s,/usr/include/libusb-1.0,${libusb1}/include/libusb-1.0, \
+      -e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor, \
+      -e s,/usr/lib/systemd/system,$out/lib/systemd/system, \
+      -e s,/var/lib/hp,$out/var/lib/hp, \
+      {} +
   '';
 
   preConfigure = ''
@@ -59,18 +93,17 @@ stdenv.mkDerivation {
       policykit_dbus_sharedir=$out/share/dbus-1/system-services
       hplip_confdir=$out/etc/hp
       hplip_statedir=$out/var/lib/hp
-    ";
+    "
   '';
 
+  enableParallelBuilding = true;
+
   postInstall =
-    ''
-    wrapPythonPrograms
-    ''
-    + (stdenv.lib.optionalString withPlugin
+    (stdenv.lib.optionalString withPlugin
     (let hplip_arch =
           if stdenv.system == "i686-linux" then "x86_32"
           else if stdenv.system == "x86_64-linux" then "x86_64"
-          else abort "Platform must be i686-linux or x86_64-linux!";
+          else abort "Plugin platform must be i686-linux or x86_64-linux!";
     in
     ''
     sh ${plugin} --noexec --keep
@@ -105,35 +138,45 @@ stdenv.mkDerivation {
     mv $out/etc/sane.d/dll.conf $out/etc/sane.d/dll.d/hpaio.conf
 
     rm $out/etc/udev/rules.d/56-hpmud.rules
-    ''));
+  ''));
+
+  fixupPhase = ''
+    # Wrap the user-facing Python scripts in $out/bin without turning the
+    # ones in $out /share into shell scripts (they need to be importable).
+    # Note that $out/bin contains only symlinks to $out/share.
+    for bin in $out/bin/*; do
+      py=`readlink -m $bin`
+      rm $bin
+      cp $py $bin
+      wrapPythonProgramsIn $bin "$out $pythonPath"
+      sed -i "s@$(dirname $bin)/[^ ]*@$py@g" $bin
+    done
 
-  buildInputs = [
-      libjpeg
-      cups
-      libusb1
-      pythonPackages.python
-      pythonPackages.wrapPython
-      saneBackends
-      dbus
-      pkgconfig
-      net_snmp
-    ] ++ stdenv.lib.optional qtSupport qt4;
+    # Remove originals. Knows a little too much about wrapPythonProgramsIn.
+    rm -f $out/bin/.*-wrapped
 
-  pythonPath = with pythonPackages; [
-      pillow
-      pythonDBus
-      pygobject
-      recursivePthLoader
-      reportlab
-    ] ++ stdenv.lib.optional qtSupport pyqt4;
+    # Merely patching shebangs in $out/share does not cause trouble.
+    for i in $out/share/hplip{,/*}/*.py; do
+      substituteInPlace $i \
+        --replace /usr/bin/python \
+        ${pythonPackages.python}/bin/${pythonPackages.python.executable} \
+        --replace "/usr/bin/env python" \
+        ${pythonPackages.python}/bin/${pythonPackages.python.executable}
+    done
+
+    wrapPythonProgramsIn $out/lib "$out $pythonPath"
+
+    substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+  '';
 
   meta = with stdenv.lib; {
+    inherit version;
     description = "Print, scan and fax HP drivers for Linux";
     homepage = http://hplipopensource.com/;
     license = if withPlugin
       then licenses.unfree
       else with licenses; [ mit bsd2 gpl2Plus ];
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ ttuegel jgeerds ];
+    platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ];
+    maintainers = with maintainers; [ jgeerds nckx ];
   };
 }
diff --git a/pkgs/misc/drivers/sundtek/default.nix b/pkgs/misc/drivers/sundtek/default.nix
new file mode 100644
index 000000000000..b3a3252a4a2c
--- /dev/null
+++ b/pkgs/misc/drivers/sundtek/default.nix
@@ -0,0 +1,48 @@
+{ fetchurl, stdenv }:
+
+with stdenv.lib;
+
+let
+  version = "2015-09-07";
+  rpath = makeLibraryPath [ "$out/lib" "$out/bin" ];
+  platform = with stdenv;
+    if isx86_64 then "64bit"
+    else
+    if isi686 then "32bit"
+    else abort "${system} not considered in build derivation. Might still be supported.";
+
+in
+  stdenv.mkDerivation {
+    src = fetchurl {
+      url = "http://www.sundtek.de/media/netinst/${platform}/installer.tar.gz";
+      sha256 = "159221lxxs5a37akamp8jc3b5ny36451mgjljajvck0c6qb6fkpr";
+    };
+    name = "sundtek-${version}";
+
+    phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
+
+    sourceRoot = ".";
+
+    installPhase = ''
+      cp -r opt $out
+
+      # add and fix pkg-config file
+      mkdir -p $out/lib/pkgconfig
+      substitute $out/doc/libmedia.pc $out/lib/pkgconfig/libmedia.pc \
+        --replace /opt $out
+    '';
+
+    postFixup = ''
+      find $out -type f -exec \
+        patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \
+        patchelf --set-rpath ${rpath} {} \;
+    '';
+
+    meta = {
+      description = "Sundtek MediaTV driver";
+      maintainers = [ maintainers.simonvandel ];
+      platforms = platforms.unix;
+      license = licenses.unfree;
+      homepage = "http://support.sundtek.com/index.php/topic,1573.0.html";
+    };
+  }
diff --git a/pkgs/misc/drivers/xwiimote/default.nix b/pkgs/misc/drivers/xwiimote/default.nix
index 75e071a05ef1..9cf70db471cc 100644
--- a/pkgs/misc/drivers/xwiimote/default.nix
+++ b/pkgs/misc/drivers/xwiimote/default.nix
@@ -1,9 +1,9 @@
 { stdenv, udev, ncurses, pkgconfig, fetchurl, bluez }:
 
 stdenv.mkDerivation rec {
-  name = "xwiimote";
+  name = "xwiimote-2";
   src = fetchurl {
-    url = "https://github.com/dvdhrm/xwiimote/releases/download/xwiimote-2/xwiimote-2.tar.xz";
+    url = "https://github.com/dvdhrm/xwiimote/releases/download/${name}/${name}.tar.xz";
     sha256 = "1g9cbhblll47l300zr999xr51x2g98y49l222f77fhswd12kjzhd";
   };