about summary refs log tree commit diff
path: root/nixpkgs/pkgs/misc/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/misc/drivers')
-rw-r--r--nixpkgs/pkgs/misc/drivers/dell-530cdn/default.nix13
-rw-r--r--nixpkgs/pkgs/misc/drivers/epkowa/default.nix248
-rw-r--r--nixpkgs/pkgs/misc/drivers/epkowa/firmware_location.patch20
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix71
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-alc1100/cups-data-dir.patch13
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix70
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-alc1100/ppd.patch13
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr/cups-filter-ppd-dirs.patch62
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr/default.nix41
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr2/cups-filter-ppd-dirs.patch55
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix36
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix98
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix72
-rw-r--r--nixpkgs/pkgs/misc/drivers/foo2zjs/default.nix64
-rw-r--r--nixpkgs/pkgs/misc/drivers/foo2zjs/no-hardcode-fw.diff98
-rw-r--r--nixpkgs/pkgs/misc/drivers/foomatic-filters/default.nix41
-rw-r--r--nixpkgs/pkgs/misc/drivers/gutenprint/bin.nix66
-rw-r--r--nixpkgs/pkgs/misc/drivers/gutenprint/default.nix52
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix192
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/default.nix225
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/hplip.state4
-rw-r--r--nixpkgs/pkgs/misc/drivers/m33-linux/default.nix25
-rw-r--r--nixpkgs/pkgs/misc/drivers/moltengamepad/default.nix39
-rw-r--r--nixpkgs/pkgs/misc/drivers/postscript-lexmark/default.nix37
-rw-r--r--nixpkgs/pkgs/misc/drivers/sc-controller/default.nix63
-rw-r--r--nixpkgs/pkgs/misc/drivers/steamcontroller/default.nix35
-rw-r--r--nixpkgs/pkgs/misc/drivers/sundtek/default.nix50
-rw-r--r--nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix27
-rw-r--r--nixpkgs/pkgs/misc/drivers/xwiimote/default.nix26
29 files changed, 1856 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/misc/drivers/dell-530cdn/default.nix b/nixpkgs/pkgs/misc/drivers/dell-530cdn/default.nix
new file mode 100644
index 000000000000..9cabd8fa3396
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/dell-530cdn/default.nix
@@ -0,0 +1,13 @@
+{ runCommand, fetchurl, rpm, cpio }: let
+  version = "1.3-1";
+
+  src = fetchurl {
+    url = "http://downloads.dell.com/printer/Dell-5130cdn-Color-Laser-${version}.noarch.rpm";
+    sha256 = "0pj32sj6jcdnpa5v75af0hnvx4z0ky0m1k2522cfdx4cb1r2lna9";
+  };
+in runCommand "Dell-5130cdn-Color-Laser-1.3-1" {} ''
+  mkdir -p usr/share/cups/model
+  ${rpm}/bin/rpm2cpio ${src} | ${cpio}/bin/cpio -i
+  mkdir -p $out/share/ppd
+  mv usr/share/cups/model/Dell $out/share/ppd
+''
diff --git a/nixpkgs/pkgs/misc/drivers/epkowa/default.nix b/nixpkgs/pkgs/misc/drivers/epkowa/default.nix
new file mode 100644
index 000000000000..6bb021c4958c
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epkowa/default.nix
@@ -0,0 +1,248 @@
+{stdenv, fetchurl, fetchpatch, makeWrapper, symlinkJoin,
+pkgconfig, libtool,
+gtk2,
+libxml2,
+libxslt,
+libusb,
+sane-backends,
+rpm, cpio,
+getopt,
+patchelf, gcc
+}:
+
+let common_meta = {
+    homepage = "http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX";
+    license = with stdenv.lib.licenses; epson;
+    platforms = with stdenv.lib.platforms; linux;
+   };
+in
+############################
+#
+#  PLUGINS
+#
+############################
+
+# adding a plugin for another printer shouldn't be too difficult, but you need the firmware to test...
+
+let plugins = {
+  v330 = stdenv.mkDerivation rec {
+    name = "iscan-v330-bundle";
+    version = "1.0.1";
+    pluginVersion = "0.2.0";
+
+    src = fetchurl {
+      url = "https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz";
+      sha256 = "f6fa455f04cdfbc3d38526573260746e9546830de93ba182d0365f557d2f7df9";
+    };
+
+    buildInputs = [ patchelf rpm ];
+
+    installPhase = ''
+      ${rpm}/bin/rpm2cpio "plugins/esci-interpreter-perfection-v330-${pluginVersion}-1.x86_64.rpm" | ${cpio}/bin/cpio -idmv
+      mkdir $out{,/share,/lib}
+      cp -r ./usr/share/{iscan-data,esci}/ $out/share/
+      cp -r ./usr/lib64/esci $out/lib
+      '';
+
+    preFixup = ''
+      lib=$out/lib/esci/libesci-interpreter-perfection-v330.so
+      rpath=${gcc.cc.lib}/lib/
+      patchelf --set-rpath $rpath $lib
+      '';
+
+    passthru = {
+      registrationCommand = ''
+        $registry --add interpreter usb 0x04b8 0x0142 "$plugin/lib/esci/libesci-interpreter-perfection-v330 $plugin/share/esci/esfwad.bin"
+        '';
+      hw = "Perfection V330 Photo";
+      };
+    meta = common_meta // { description = "Plugin to support "+passthru.hw+" scanner in sane."; };
+  };
+  x770 =   stdenv.mkDerivation rec {
+    pname = "iscan-gt-x770-bundle";
+    version = "1.0.1";
+    pluginVersion = "2.1.2-1";
+
+    nativeBuildInputs = [ patchelf rpm ];
+    src = fetchurl {
+      url = "https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz";
+      sha256 = "0m9c60rszzdvq1pqfzygzzrjycm1giy465lj29108j7hsnfcv56r";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio iscan-plugin-gt-x770-${pluginVersion}.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/lib
+      mv $out/share/iscan $out/share/esci
+      mv $out/lib/iscan $out/lib/esci
+      '';
+    preFixup = ''
+      lib=$out/lib/esci/libesint7C.so
+      rpath=${gcc.cc.lib}/lib/
+      patchelf --set-rpath $rpath $lib
+      '';
+    passthru = {
+      registrationCommand = ''
+        $registry --add interpreter usb 0x04b8 0x0130 "$plugin/lib/esci/libesint7C $plugin/share/esci/esfw7C.bin"
+        '';
+      hw = "Perfection V500 Photo";
+      };
+    meta = common_meta // { description = "iscan esci x770 plugin for "+passthru.hw; };
+    };
+  f720 = stdenv.mkDerivation rec {
+    pname = "iscan-gt-f720-bundle";
+    version = "1.0.1";
+    pluginVersion = "0.1.1-2";
+
+    buildInputs = [ patchelf ];
+    src = fetchurl {
+      url = "https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz";
+      sha256 = "0dvikq5ad6wid3lxw1amar8lsbr50g39g6zlmcjxdcsg0wb1qspp";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio esci-interpreter-gt-f720-${pluginVersion}.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/lib
+      '';
+    preFixup = ''
+      lib=$out/lib/esci/libesci-interpreter-gt-f720.so
+      rpath=${gcc.cc.lib}/lib/
+      patchelf --set-rpath $rpath $lib
+      '';
+    passthru = {
+      registrationCommand = ''
+        $registry --add interpreter usb 0x04b8 0x0131 "$plugin/lib/esci/libesci-interpreter-gt-f720 $plugin/share/esci/esfw8b.bin"
+        '';
+      hw = "GT-F720, GT-S620, Perfection V30, Perfection V300 Photo";
+      };
+
+    meta = common_meta // { description = "iscan esci f720 plugin for "+passthru.hw; };
+  };
+  s80 = stdenv.mkDerivation rec {
+    pname = "iscan-gt-s80-bundle";
+    version = "1.0.1";
+    esciPluginVersion = "0.2.1-1";
+    esdipPluginVersion = "1.0.0-5";
+
+    buildInputs = [ patchelf ];
+    src = fetchurl {
+      url = "https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz";
+      sha256 = "14j11znx5ga2ykpyg6kjg7lbrddyr9pwxrsa82dmdishd1j7zji9";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio esci-interpreter-gt-s80-${esciPluginVersion}.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      ${rpm}/bin/rpm2cpio iscan-plugin-esdip-${esdipPluginVersion}.ltdl7.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/lib
+      mkdir $out/share/esci
+      '';
+    preFixup = ''
+      rpath=${gcc.cc.lib}/lib/
+      patchelf --set-rpath $rpath $out/lib/esci/libesci-interpreter-gt-s80.so
+      patchelf --set-rpath $rpath $out/lib/esci/libesci-interpreter-gt-s50.so
+      patchelf --set-rpath $rpath $out/lib/iscan/esdip
+      patchelf --set-rpath $rpath $out/lib/iscan/libesdtr.so.0
+      patchelf --set-rpath $rpath $out/lib/iscan/libesdtr2.so.0
+      '';
+    passthru = {
+      registrationCommand = ''
+        $registry --add interpreter usb 0x04b8 0x0136 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
+        $registry --add interpreter usb 0x04b8 0x0137 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
+        $registry --add interpreter usb 0x04b8 0x0143 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
+        $registry --add interpreter usb 0x04b8 0x0144 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
+        '';
+      hw = "ES-D200, ED-D350, ES-D400, GT-S50, GT-S55, GT-S80, GT-S85";
+      };
+
+    meta = common_meta // { description = "iscan esci s80 plugin for "+passthru.hw; };
+  };
+};
+in
+
+
+
+let fwdir = symlinkJoin {
+  name = "esci-firmware-dir";
+  paths = stdenv.lib.mapAttrsToList (name: value: value + /share/esci) plugins;
+};
+in
+let iscan-data = stdenv.mkDerivation rec {
+  name = "iscan-data-${version}";
+  version = "1.39.0-1";
+
+  src = fetchurl {
+    url = "http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz";
+    sha256 = "0pvm67gqyvzhnv5qyfbaz802l4sbgvaf0zb8wz60k1wcasb99vv1";
+  };
+
+  buildInputs = [
+    libxslt
+  ];
+
+  meta = common_meta;
+};
+in
+stdenv.mkDerivation rec {
+  name = "iscan-${version}";
+  version = "2.30.3-1";
+
+  src = fetchurl {
+    url = "http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz";
+    sha256 = "0ryy946h7ddmxh866hfszqfyff1qy4svpsk7w3739v75f4awr9li";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gtk2
+    libxml2
+    libtool
+    libusb
+    sane-backends
+    makeWrapper
+  ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf";
+      sha256 = "04y70qjd220dpyh771fiq50lha16pms98mfigwjczdfmx6kpj1jd";
+    })
+    ./firmware_location.patch
+    ];
+  patchFlags = "-p0";
+
+  configureFlags = [ "--disable-static" "--enable-dependency-reduction" "--disable-frontend"];
+
+  postConfigure = ''
+    echo '#define NIX_ESCI_PREFIX "'${fwdir}'"' >> config.h
+    '';
+
+  postInstall = ''
+    mkdir -p $out/etc/sane.d
+    cp backend/epkowa.conf $out/etc/sane.d
+    echo "epkowa" > $out/etc/sane.d/dll.conf
+    ln -s ${iscan-data}/share/iscan-data $out/share/iscan-data
+    '';
+  postFixup = ''
+    # iscan-registry is a shell script requiring getopt
+    wrapProgram $out/bin/iscan-registry --prefix PATH : ${getopt}/bin
+    registry=$out/bin/iscan-registry;
+    '' +
+    stdenv.lib.concatStrings (stdenv.lib.mapAttrsToList (name: value: ''
+    plugin=${value};
+    ${value.passthru.registrationCommand}
+    '') plugins);
+  meta = common_meta // {
+    description = "sane-epkowa backend for some epson scanners.";
+    longDescription = ''
+      Includes gui-less iscan (aka. Image Scan! for Linux).
+      Supported hardware: at least :
+    '' +
+    stdenv.lib.concatStringsSep ", " (stdenv.lib.mapAttrsToList (name: value: value.passthru.hw) plugins);
+    maintainers = with stdenv.lib.maintainers; [ symphorien ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/epkowa/firmware_location.patch b/nixpkgs/pkgs/misc/drivers/epkowa/firmware_location.patch
new file mode 100644
index 000000000000..58ea849d8f9d
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epkowa/firmware_location.patch
@@ -0,0 +1,20 @@
+Explanation:
+in libesci-interpreter-gt-f720.so in
+libesci_interpreter_gt_f720_342::libesci_interpreter_gt_f720_348 at 0xdf74: the
+binary blob esfw8b.bin is searched either in /usr/share/esci/ or in
+$ESCI_FIRMWARE_DIR. But since this library is to be used wia libsane.so in
+every binary in the system, we can't wrapProgram the relevant executables to
+set this environment variable. Instead, we patch iscan to set this variable
+before loading libesci-interpreter-gt-f720.so.
+--- backend/channel-usb.c.orig	2017-08-14 11:24:27.669582456 +0200
++++ backend/channel-usb.c	2017-08-14 11:31:40.509010897 +0200
+@@ -169,6 +169,9 @@
+ {
+   SANE_Status s;
+ 
++  setenv("ESCI_FIRMWARE_DIR", NIX_ESCI_PREFIX, 1);
++  setenv("ISCAN_FW_DIR", NIX_ESCI_PREFIX, 1);
++
+   s = sanei_usb_open (self->name, &self->fd);
+ 
+   if (SANE_STATUS_GOOD == s)
diff --git a/nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix b/nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix
new file mode 100644
index 000000000000..c61bfb806c59
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
+
+let
+  version = "1.0.1";
+  filterVersion = "1.0.0";
+in
+  stdenv.mkDerivation {
+
+    name = "epson-201106w-${version}";
+
+    src = fetchurl {
+      url = "https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201106w-${version}-1lsb3.2.src.rpm";
+      sha256 = "1yig1xrh1ikblbp7sx706n5nnc237wy4mbch23ymy6akbgqg4aig";
+    };
+
+    nativeBuildInputs = [ rpmextract autoreconfHook file ];
+
+    buildInputs = [ libjpeg cups ];
+
+    unpackPhase = ''
+      rpmextract $src
+      tar -zxf epson-inkjet-printer-201106w-${version}.tar.gz
+      tar -zxf epson-inkjet-printer-filter-${filterVersion}.tar.gz
+      for ppd in epson-inkjet-printer-201106w-${version}/ppds/*; do
+        substituteInPlace $ppd --replace "/opt/epson-inkjet-printer-201106w" "$out"
+        substituteInPlace $ppd --replace "/cups/lib" "/lib/cups"
+      done
+      cd epson-inkjet-printer-filter-${filterVersion}
+    '';
+
+    preConfigure = ''
+      chmod +x configure
+      export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
+    '';
+
+    postInstall = ''
+      cd ../epson-inkjet-printer-201106w-${version}
+      cp -a lib64 resource watermark $out
+      mkdir -p $out/share/cups/model/epson-inkjet-printer-201106w
+      cp -a ppds $out/share/cups/model/epson-inkjet-printer-201106w/
+      cp -a Manual.txt $out/doc/
+      cp -a README $out/doc/README.driver
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = https://www.openprinting.org/driver/epson-201106w;
+      description = "Epson printer driver (BX535WD, BX630FW, BX635FWD, ME940FW, NX530, NX635, NX635, SX535WD, WorkForce 545, WorkForce 645";
+      longDescription = ''
+        This software is a filter program used with the Common UNIX Printing
+        System (CUPS) under Linux. It supplies high quality printing with
+        Seiko Epson Color Ink Jet Printers.
+        List of printers supported by this package:
+          Epson BX535WD Series
+          Epson BX630FW Series
+          Epson BX635FWD Series
+          Epson ME940FW Series
+          Epson NX530 Series
+          Epson SX535WD Series
+          Epson WorkForce 545 Series
+          Epson WorkForce 645 Series
+        To use the driver adjust your configuration.nix file:
+          services.printing = {
+            enable = true;
+            drivers = [ pkgs.epson-201106w ];
+          };
+      '';
+      license = with licenses; [ lgpl21 epson ];
+      platforms = platforms.linux;
+      maintainers = [ maintainers.nphilou ];
+    };
+  }
diff --git a/nixpkgs/pkgs/misc/drivers/epson-alc1100/cups-data-dir.patch b/nixpkgs/pkgs/misc/drivers/epson-alc1100/cups-data-dir.patch
new file mode 100644
index 000000000000..2277a9afcccf
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-alc1100/cups-data-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/configure b/configure
+index 0053441..9a6b855 100755
+--- a/configure
++++ b/configure
+@@ -2833,7 +2833,7 @@ if test $have_cups_config = yes; then
+    CUPS_LIBS=`cups-config --libs`
+    CUPS_IMAGE_LIBS=`cups-config --image --libs`
+    CUPS_SERVER_DIR=`cups-config --serverbin`
+-   CUPS_DATA_DIR=`cups-config --datadir`
++   CUPS_DATA_DIR="${prefix}/share/cups"
+ else
+    { { echo "$as_me:$LINENO: error: *** 'cups-config' missing, please install CUPS or fix your \$PATH ***" >&5
+ echo "$as_me: error: *** 'cups-config' missing, please install CUPS or fix your \$PATH ***" >&2;}
diff --git a/nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix b/nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix
new file mode 100644
index 000000000000..1dac6034fdab
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, cups, pkgsi686Linux, dpkg, psutils, makeWrapper, ghostscript, bash }:
+
+let
+  version = "1.2-0";
+
+  libstdcpp5 = fetchurl {
+    url = "http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_i386.deb";
+    sha256 = "10f8zcmqaa7skvg2bz94mnlgqpan4iscvi8913r6iawjh7hiisjy";
+  };
+in
+  stdenv.mkDerivation {
+    name = "epson-alc1100-${version}";
+
+    src = fetchurl {
+      url = "http://a1227.g.akamai.net/f/1227/40484/7d/download.ebz.epson.net/dsc/f/01/00/01/58/65/cd71929d2bf41ebf7e96f68fa9f1279556545ef1/Epson-ALC1100-filter-1.2.tar.gz";
+      sha256 = "0q0bf4dfm4v69l7xg6sgkh7rwb0h77i8j9kplq1dfkd208g7y81p";
+    };
+
+    patches = [ ./cups-data-dir.patch ./ppd.patch ];
+
+    nativeBuildInputs = [ dpkg makeWrapper ];
+
+    buildInputs = [ cups pkgsi686Linux.glibc psutils ghostscript bash ];
+
+    postUnpack = ''
+      dpkg -x ${libstdcpp5} libstdcpp5_i386;
+
+      mkdir -p $out/lib;
+
+      mv libstdcpp5_i386/usr/lib/* $out/lib;
+    '';
+
+    postFixup = ''
+      patchelf --set-interpreter ${pkgsi686Linux.glibc}/lib/ld-linux.so.2 \
+        --set-rpath "${stdenv.lib.makeLibraryPath [
+          pkgsi686Linux.glibc
+          "$out"
+        ]}" $out/bin/alc1100
+
+      patchelf --set-rpath "${stdenv.lib.makeLibraryPath [
+          pkgsi686Linux.glibc
+        ]}" $out/lib/libstdc++.so.5.0.7
+
+      wrapProgram $out/bin/alc1100_lprwrapper.sh \
+        --suffix PATH : "\$PATH:${psutils}/bin:/var/lib/cups/path/bin"
+
+      wrapProgram $out/bin/pstoalc1100.sh \
+        --suffix PATH : "\$PATH:${psutils}/bin:${ghostscript}/bin:${bash}/bin:/var/lib/cups/path/bin"
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
+      description = "Epson AcuLaser C1100 Driver";
+      longDescription = ''
+        This package provides a print filter for printing to EPSON AL-C1100
+        printers on Linux systems.
+
+        To use the driver adjust your configuration.nix file:
+          services.printing = {
+            enable = true;
+            drivers = [ pkgs.epson-alc1100 ];
+          };
+      '';
+
+      license = with licenses; [ mit eapl ];
+      maintainers = [ maintainers.eperuffo ];
+      platforms = platforms.linux;
+    };
+
+  }
diff --git a/nixpkgs/pkgs/misc/drivers/epson-alc1100/ppd.patch b/nixpkgs/pkgs/misc/drivers/epson-alc1100/ppd.patch
new file mode 100644
index 000000000000..71d86668f53d
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-alc1100/ppd.patch
@@ -0,0 +1,13 @@
+diff --git a/ppd/Epson-AL-C1100-fm3.ppd b/ppd/Epson-AL-C1100-fm3.ppd
+index 75c7fff..ecd04c8 100644
+--- a/ppd/Epson-AL-C1100-fm3.ppd
++++ b/ppd/Epson-AL-C1100-fm3.ppd
+@@ -68,7 +68,7 @@
+ *%*********** Foomatic Configulations ************
+ *%pprRIP:        foomatic-rip other
+ *FoomaticIDs: Epson-AL-C1100 alc1100
+-*FoomaticRIPCommandLine: "pstoalc1100.sh %C"
++*FoomaticRIPCommandLine: "/var/lib/cups/path/bin/pstoalc1100.sh %C"
+ 
+ *%**************** Paper Handling ******************
+ 
diff --git a/nixpkgs/pkgs/misc/drivers/epson-escpr/cups-filter-ppd-dirs.patch b/nixpkgs/pkgs/misc/drivers/epson-escpr/cups-filter-ppd-dirs.patch
new file mode 100644
index 000000000000..fb546b6a25b7
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr/cups-filter-ppd-dirs.patch
@@ -0,0 +1,62 @@
+diff --git a/configure b/configure_new
+index 699bcb5..89a1832 100755
+--- a/configure
++++ b/configure_new
+@@ -11585,55 +11585,8 @@ else
+ $as_echo "no" >&6; }
+ fi
+ 
+-
+-
+-if test "xNONE" != "x${prefix}" ; then
+-   cups_default_prefix="${prefix}"
+-else
+-   cups_default_prefix="${ac_default_prefix}"
+-fi
+-
+-
+-# Check whether --with-cupsfilterdir was given.
+-if test "${with_cupsfilterdir+set}" = set; then :
+-  withval=$with_cupsfilterdir;
+-else
+-  with_cupsfilterdir=no
+-fi
+-
+-if test "xno" = "x${with_cupsfilterdir}"; then
+-   if test "xyes" = "x$have_cups_config" ; then
+-            CUPS_FILTER_DIR="${cups_default_prefix}`cups-config --serverbin | sed -e 's,^/[^/][^/]*,,'`/filter"
+-   else
+-      CUPS_FILTER_DIR="${cups_default_prefix}/lib/cups/filter"
+-   fi
+-else
+-   CUPS_FILTER_DIR="${with_cupsfilterdir}"
+-fi
+-
+-
+-# Check whether --with-cupsppddir was given.
+-if test "${with_cupsppddir+set}" = set; then :
+-  withval=$with_cupsppddir;
+-else
+-  with_cupsppddir=no
+-fi
+-
+-if test "xno" = "x${with_cupsppddir}"; then
+-   if test -d "${cups_default_prefix}/share/ppd" ; then
+-      CUPS_PPD_DIR="${cups_default_prefix}/share/ppd"
+-   elif test "xyes" = "x$have_cups_config" ; then
+-            CUPS_PPD_DIR="${cups_default_prefix}/`cups-config --datadir | sed -e 's,^/[^/][^/]*,,'`/model"
+-   else
+-      CUPS_PPD_DIR="${cups_default_prefix}/share/cups/model"
+-   fi
+-else
+-   CUPS_PPD_DIR="${with_cupsppddir}"
+-fi
+-
+-
+-
+-
++CUPS_FILTER_DIR="${prefix}/lib/cups/filter"
++CUPS_PPD_DIR="${prefix}/share/cups/model"
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+ $as_echo_n "checking for ANSI C header files... " >&6; }
diff --git a/nixpkgs/pkgs/misc/drivers/epson-escpr/default.nix b/nixpkgs/pkgs/misc/drivers/epson-escpr/default.nix
new file mode 100644
index 000000000000..ce95ca00e110
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, cups }:
+
+stdenv.mkDerivation rec {
+  name = "epson-escpr-${version}";
+  version = "1.6.16";
+
+  src = fetchurl {
+    url = "https://download3.ebz.epson.net/dsc/f/03/00/06/41/54/29588ed107f800e5bc3f91706661567efb369c1c/epson-inkjet-printer-escpr-1.6.16-1lsb3.2.tar.gz";
+    sha256 = "0v9mcih3dg3ws18hdcgm014k97hv6imga39hy2a84gnc6badp6n6";
+  };
+
+  patches = [ ./cups-filter-ppd-dirs.patch ];
+
+  buildInputs = [ cups ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
+    description = "ESC/P-R Driver (generic driver)";
+    longDescription = ''
+      Epson Inkjet Printer Driver (ESC/P-R) for Linux and the
+      corresponding PPD files. The list of supported printers
+      can be found at http://www.openprinting.org/driver/epson-escpr/ .
+
+      To use the driver adjust your configuration.nix file:
+        services.printing = {
+          enable = true;
+          drivers = [ pkgs.epson-escpr ];
+        };
+
+      To setup a wireless printer, enable Avahi which provides
+      printer's hostname to CUPS and nss-mdns to make this
+      hostname resolvable:
+        services.avahi = {
+          enable = true;
+          nssmdns = true;
+        };'';
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ artuuge ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/epson-escpr2/cups-filter-ppd-dirs.patch b/nixpkgs/pkgs/misc/drivers/epson-escpr2/cups-filter-ppd-dirs.patch
new file mode 100644
index 000000000000..02897f4f44d9
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr2/cups-filter-ppd-dirs.patch
@@ -0,0 +1,55 @@
+diff --git a/configure.orig b/configure
+index e9d400f..dac1943 100755
+--- a/configure.orig
++++ b/configure
+@@ -12184,48 +12184,8 @@ esac
+ #	*)		ESCPR_LIB_NAME="escpr2_32" ;;
+ #esac
+ 
+-
+-
+-# Check whether --with-cupsfilterdir was given.
+-if test "${with_cupsfilterdir+set}" = set; then :
+-  withval=$with_cupsfilterdir;
+-else
+-  with_cupsfilterdir=no
+-fi
+-
+-if test "xno" = "x${with_cupsfilterdir}"; then
+-   if test "xyes" = "x$have_cups_config" ; then
+-            CUPS_FILTER_DIR="${cups_default_prefix}`cups-config --serverbin | sed -e 's,^/[^/][^/]*,,'`/filter"
+-   else
+-      CUPS_FILTER_DIR="${cups_default_prefix}/lib/cups/filter"
+-   fi
+-else
+-   CUPS_FILTER_DIR="${with_cupsfilterdir}"
+-fi
+-
+-
+-# Check whether --with-cupsppddir was given.
+-if test "${with_cupsppddir+set}" = set; then :
+-  withval=$with_cupsppddir;
+-else
+-  with_cupsppddir=no
+-fi
+-
+-if test "xno" = "x${with_cupsppddir}"; then
+-   if test -d "${cups_default_prefix}/share/ppd" ; then
+-      CUPS_PPD_DIR="${cups_default_prefix}/share/ppd"
+-   elif test "xyes" = "x$have_cups_config" ; then
+-            CUPS_PPD_DIR="${cups_default_prefix}`cups-config --datadir | sed -e 's,^/[^/][^/]*,,'`/model"
+-   else
+-      CUPS_PPD_DIR="${cups_default_prefix}/share/cups/model"
+-   fi
+-else
+-   CUPS_PPD_DIR="${with_cupsppddir}"
+-fi
+-
+-
+-
+-
++CUPS_FILTER_DIR="${prefix}/lib/cups/filter"
++CUPS_PPD_DIR="${prefix}/share/cups/model"
+ 
+ # Check whether --enable-lsb was given.
+ if test "${enable_lsb+set}" = set; then :
diff --git a/nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix b/nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix
new file mode 100644
index 000000000000..9ce6f5d7b010
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, cups, busybox }:
+
+stdenv.mkDerivation rec {
+  name = "epson-inkjet-printer-escpr2-${version}";
+  version = "1.0.29";
+
+  src = fetchurl {
+    url = "https://download3.ebz.epson.net/dsc/f/03/00/09/02/31/a332507b6398c6e2e007c05477dd6c3d5a8e50eb/${name}-1lsb3.2.src.rpm";
+    sha256 = "064br52akpw5yrxb2wqw2klv4jrvyipa7w0rjj974xgyi781lqs5";
+  };
+
+  patches = [ ./cups-filter-ppd-dirs.patch ];
+
+  buildInputs = [ cups busybox ];
+
+  unpackPhase = ''
+    rpm2cpio $src | cpio -idmv
+
+    tar xvf ${name}-1lsb3.2.tar.gz
+    cd ${name}
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
+    description = "ESC/P-R 2 Driver (generic driver)";
+    longDescription = ''
+      Epson Inkjet Printer Driver 2 (ESC/P-R 2) for Linux and the
+      corresponding PPD files.
+
+      Refer to the description of epson-escpr for usage.
+    '';
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ma9e ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix b/nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix
new file mode 100644
index 000000000000..15a7ba3cd3c4
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix
@@ -0,0 +1,98 @@
+{
+  autoreconfHook, cups, gzip, libjpeg, rpmextract,
+  fetchurl, lib, stdenv
+}:
+
+let
+  srcdirs = {
+    filter = "epson-inkjet-printer-filter-1.0.0";
+    driver = "epson-inkjet-printer-workforce-635-nx625-series-1.0.1";
+  };
+in stdenv.mkDerivation rec {
+  name = "epson-inkjet-printer-workforce-635-nx625-series";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url = "https://download.ebz.epson.net/dsc/op/stable/SRPMS/${name}-${version}-1lsb3.2.src.rpm";
+    sha256 = "19nb2h0y9rvv6rg7j262f8sqap9kjvz8kmisxnjg1w0v19zb9zf2";
+  };
+  sourceRoot = srcdirs.filter;
+
+  nativeBuildInputs = [ autoreconfHook gzip rpmextract ];
+  buildInputs = [ cups libjpeg ];
+
+  unpackPhase = ''
+    rpmextract "$src"
+    for i in ${lib.concatStringsSep " " (builtins.attrValues srcdirs)}; do
+        tar xvf "$i".tar.gz
+    done
+  '';
+
+  preConfigure = ''
+    chmod u+x configure
+  '';
+
+  installPhase =
+    let
+      filterdir = "$out/cups/lib/filter";
+      docdir  = "$out/share/doc";
+      ppddir  = "$out/share/cups/model/${name}";
+      libdir =
+        if stdenv.system == "x86_64-linux"    then "lib64"
+        else if stdenv.system == "i686_linux" then "lib"
+        else throw "other platforms than i686_linux and x86_64-linux are not yet supported";
+    in ''
+      mkdir -p "$out" "${docdir}" "${filterdir}" "${ppddir}"
+      cp src/epson_inkjet_printer_filter "${filterdir}"
+
+      cd ../${srcdirs.driver}
+      for ppd in ppds/*; do
+          substituteInPlace "$ppd" --replace '/opt/${name}' "$out"
+          gzip -c "$ppd" > "${ppddir}/''${ppd#*/}"
+      done
+      cp COPYING.EPSON README "${docdir}"
+      cp -r resource watermark ${libdir} "$out"
+    '';
+
+  meta = {
+    description = "Proprietary CUPS drivers for Epson inkjet printers";
+    longDescription = ''
+      This software is a filter program used with Common UNIX Printing
+      System (CUPS) from the Linux. This can supply the high quality print
+      with Seiko Epson Color Ink Jet Printers.
+
+      This printer driver is supporting the following printers.
+
+      WorkForce 60
+      WorkForce 625
+      WorkForce 630
+      WorkForce 633
+      WorkForce 635
+      WorkForce T42WD
+      Epson Stylus NX625
+      Epson Stylus SX525WD
+      Epson Stylus SX620FW
+      Epson Stylus TX560WD
+      Epson Stylus Office B42WD
+      Epson Stylus Office BX525WD
+      Epson Stylus Office BX625FWD
+      Epson Stylus Office TX620FWD
+      Epson ME OFFICE 82WD
+      Epson ME OFFICE 85ND
+      Epson ME OFFICE 900WD
+      Epson ME OFFICE 960FWD
+
+      License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT
+
+      To use the driver adjust your configuration.nix file:
+        services.printing = {
+          enable = true;
+          drivers = [ pkgs.${name} ];
+        };
+    '';
+    downloadPage = https://download.ebz.epson.net/dsc/du/02/DriverDownloadInfo.do?LG2=EN&CN2=&DSCMI=16857&DSCCHK=4334d3487503d7f916ccf5d58071b05b7687294f;
+    license = with lib.licenses; [ lgpl21 epson ];
+    maintainers = [ lib.maintainers.jorsn ];
+    platforms = [ "x86_64-linux" "i686-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix b/nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix
new file mode 100644
index 000000000000..2a92f8a59d91
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
+
+let
+  version = "1.0.0";
+in
+  stdenv.mkDerivation {
+
+    name = "epson_201207w-${version}";
+
+    src = fetchurl {
+      url = "https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201207w-${version}-1lsb3.2.src.rpm";
+      sha256 = "1ixnhn2dk83nh9v8sdivzgc2bm9z2phvsbx8bc6ainbjq6vn7lns";
+    };
+
+    nativeBuildInputs = [ rpmextract autoreconfHook file ];
+
+    buildInputs = [ libjpeg cups ];
+
+    unpackPhase = ''
+      rpmextract $src
+      tar -zxf epson-inkjet-printer-201207w-${version}.tar.gz
+      tar -zxf epson-inkjet-printer-filter-${version}.tar.gz
+      for ppd in epson-inkjet-printer-201207w-${version}/ppds/*; do
+        substituteInPlace $ppd --replace "/opt/epson-inkjet-printer-201207w" "$out"
+        substituteInPlace $ppd --replace "/cups/lib" "/lib/cups"
+      done
+      cd epson-inkjet-printer-filter-${version}
+    '';
+
+    preConfigure = ''
+      chmod +x configure
+      export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
+    '';
+
+    postInstall = ''
+      cd ../epson-inkjet-printer-201207w-${version}
+      cp -a lib64 resource watermark $out
+      mkdir -p $out/share/cups/model/epson-inkjet-printer-201207w
+      cp -a ppds $out/share/cups/model/epson-inkjet-printer-201207w/
+      cp -a Manual.txt $out/doc/
+      cp -a README $out/doc/README.driver
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = https://www.openprinting.org/driver/epson-201207w;
+      description = "Epson printer driver (L110, L210, L300, L350, L355, L550, L555)";
+      longDescription = ''
+        This software is a filter program used with the Common UNIX Printing
+        System (CUPS) under Linux. It supplies high quality printing with
+        Seiko Epson Color Ink Jet Printers.
+
+        List of printers supported by this package:
+           Epson L110 Series
+           Epson L210 Series
+           Epson L300 Series
+           Epson L350 Series
+           Epson L355 Series
+           Epson L550 Series
+           Epson L555 Series
+
+	To use the driver adjust your configuration.nix file:
+	  services.printing = {
+	    enable = true;
+	    drivers = [ pkgs.epson_201207w ];
+	  };
+      '';
+      license = with licenses; [ lgpl21 epson ];
+      maintainers = [ maintainers.romildo ];
+      platforms = [ "x86_64-linux" ];
+    };
+
+  }
diff --git a/nixpkgs/pkgs/misc/drivers/foo2zjs/default.nix b/nixpkgs/pkgs/misc/drivers/foo2zjs/default.nix
new file mode 100644
index 000000000000..7e1ff01bda05
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/foo2zjs/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl, foomatic-filters, bc, unzip, ghostscript, systemd, vim, time }:
+
+stdenv.mkDerivation rec {
+  name = "foo2zjs-20180519";
+
+  src = fetchurl {
+    url = "http://www.loegria.net/mirrors/foo2zjs/${name}.tar.gz";
+    sha256 = "1rmw4jmxn2lqp124mapvnic0ma8ipyvisx2vj848mvad5g5w9x3z";
+  };
+
+  buildInputs = [ foomatic-filters bc unzip ghostscript systemd vim ];
+
+  patches = [ ./no-hardcode-fw.diff ];
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "APPL=$(out)/share/applications"
+    "PIXMAPS=$(out)/share/pixmaps"
+    "UDEVBIN=$(out)/bin"
+    "UDEVDIR=$(out)/etc/udev/rules.d"
+    "UDEVD=${systemd}/sbin/udevd"
+    "LIBUDEVDIR=$(out)/lib/udev/rules.d"
+    "USBDIR=$(out)/etc/hotplug/usb"
+    "FOODB=$(out)/share/foomatic/db/source"
+    "MODEL=$(out)/share/cups/model"
+  ];
+
+  installFlags = [ "install-hotplug" ];
+
+  postPatch = ''
+    touch all-test
+    sed -e "/BASENAME=/iPATH=$out/bin:$PATH" -i *-wrapper *-wrapper.in
+    sed -e "s@PREFIX=/usr@PREFIX=$out@" -i *-wrapper{,.in}
+    sed -e "s@/usr/share@$out/share@" -i hplj10xx_gui.tcl
+    sed -e "s@\[.*-x.*/usr/bin/logger.*\]@type logger >/dev/null 2>\&1@" -i *wrapper{,.in}
+    sed -e '/install-usermap/d' -i Makefile
+    sed -e "s@/etc/hotplug/usb@$out&@" -i *rules*
+    sed -e "s@/usr@$out@g" -i hplj1020.desktop
+    sed -e "/PRINTERID=/s@=.*@=$out/bin/usb_printerid@" -i hplj1000
+  '';
+
+  checkInputs = [ time ];
+  doCheck = false; # fails to find its own binary. Also says "Tests will pass only if you are using ghostscript-8.71-16.fc14".
+
+  preInstall = ''
+    mkdir -pv $out/{etc/udev/rules.d,lib/udev/rules.d,etc/hotplug/usb}
+    mkdir -pv $out/share/foomatic/db/source/{opt,printer,driver}
+    mkdir -pv $out/share/cups/model
+    mkdir -pv $out/share/{applications,pixmaps}
+
+    mkdir -pv "$out/bin"
+    cp -v getweb arm2hpdl "$out/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "ZjStream printer drivers";
+    maintainers = with maintainers;
+    [
+      raskin
+    ];
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/foo2zjs/no-hardcode-fw.diff b/nixpkgs/pkgs/misc/drivers/foo2zjs/no-hardcode-fw.diff
new file mode 100644
index 000000000000..003272858a42
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/foo2zjs/no-hardcode-fw.diff
@@ -0,0 +1,98 @@
+#
+#
+# patch "hplj1000"
+#  from [d5336e74866d31735d97874191351a0dcc092b44]
+#    to [55102b37684ee5181674d19d866caec2cf603412]
+#
+============================================================
+--- a/hplj1000	d5336e74866d31735d97874191351a0dcc092b44
++++ b/hplj1000	55102b37684ee5181674d19d866caec2cf603412
+@@ -39,11 +39,6 @@ DEV=""
+ DEV=""
+ 
+ #
+-# Directory to find downloadable HP firmware files sihpMMMM.dl
+-#
+-FWDIR=/usr/share/foo2zjs/firmware
+-
+-#
+ # Program used to determine USB printer id information
+ #
+ # NOTE: /usr/bin is NOT mounted at this point
+@@ -83,57 +78,61 @@ case "$0" in
+     MODEL=P1005; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x3d17	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *P1006)
+     MODEL=P1006; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x3e17	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *P1007)
+     MODEL=P1007; FWMODEL=P1005		# Alias
+     USB1=0x03f0	#Vendor
+     USB2=0x4817	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *P1008)
+     MODEL=P1008; FWMODEL=P1006		# Alias
+     USB1=0x03f0	#Vendor
+     USB2=0x4917	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *P1505)
+     MODEL=P1505; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x3f17	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *P1505n)
+     MODEL=P1505n; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x4017	#Model
+-    FWDIR=/usr/share/foo2xqx/firmware
++    DRIVER=foo2xqx
+     ;;
+ *1000)
+     MODEL=1000; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x0517	#Model
++    DRIVER=foo2zjs
+     ;;
+ *1005)
+     MODEL=1005; FWMODEL=$MODEL
+     USB1=0x03f0	#Vendor
+     USB2=0x1317	#Model
++    DRIVER=foo2zjs
+     ;;
+ *1018)
+     MODEL=1018; FWMODEL=$MODEL
+     USB1=0x03f0 #Vendor
+     USB2=0x4117 #Model
++    DRIVER=foo2zjs
+     ;;
+ *1020)
+     MODEL=1020; FWMODEL=$MODEL
+     USB1=0x03f0 #Vendor
+     USB2=0x2b17 #Model
++    DRIVER=foo2zjs
+     ;;
+ *)
+     log "Only HP LaserJet 100[05],1018,1020,P100[5678],P1505 are supported"
+@@ -203,7 +202,7 @@ load1() {
+ #
+ load1() {
+     _dev="$1"
+-    fw="$FWDIR/sihp$FWMODEL.dl"
++    fw="${FOO2ZJS_DATADIR:-/usr/share}/$DRIVER/firmware/sihp$FWMODEL.dl"
+     if [ ! -f "$fw" ]; then
+ 	log "Missing HP LaserJet $MODEL firmware file $fw"
+ 	log "...read foo2zjs installation instructions and run ./getweb $MODEL"
diff --git a/nixpkgs/pkgs/misc/drivers/foomatic-filters/default.nix b/nixpkgs/pkgs/misc/drivers/foomatic-filters/default.nix
new file mode 100644
index 000000000000..580b473b0cd6
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/foomatic-filters/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchpatch, fetchurl, pkgconfig, perl, cups, dbus, enscript }:
+
+stdenv.mkDerivation rec {
+  name = "foomatic-filters-4.0.17";
+
+  src = fetchurl {
+    url = "https://www.openprinting.org/download/foomatic/${name}.tar.gz";
+    sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ perl cups dbus enscript ];
+
+  patches = [
+    # for CVE-2015-8327 & CVE-2015-8560
+    (fetchpatch {
+      url = "https://anonscm.debian.org/cgit/collab-maint/foomatic-filters.git/plain/debian/patches/0500-r7406_also_consider_the_back_tick_as_an_illegal_shell_escape_character.patch";
+      sha256 = "055nwi3sjf578nk40bqsch3wx8m2h65hdih0wmxflb6l0hwkq4p4";
+    })
+  ];
+
+  preConfigure =
+    ''
+      substituteInPlace foomaticrip.c --replace /bin/bash ${stdenv.shell}
+    '';
+
+  installTargets = "install-cups";
+
+  installFlags =
+    ''
+      CUPS_FILTERS=$(out)/lib/cups/filter
+      CUPS_BACKENDS=$(out)/lib/cups/backend
+    '';
+
+  meta = {
+    description = "Foomatic printing filters";
+    maintainers = [ stdenv.lib.maintainers.raskin ];
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/gutenprint/bin.nix b/nixpkgs/pkgs/misc/drivers/gutenprint/bin.nix
new file mode 100644
index 000000000000..6cf754192f86
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/gutenprint/bin.nix
@@ -0,0 +1,66 @@
+{ stdenv, fetchurl, rpm, cpio, zlib }:
+
+/* usage: (sorry, its still impure but works!)
+
+impure directory:
+mkdir /opt/gutenprint; sudo cp -r $(nix-build -A gutenprintBin -f $NIXPGS_ALL) /opt/gutenprint
+
+add the following lines to bindirCmds property of  printing/cupsd.nix:
+
+  ln -s ${pkgs.gutenprintBin}/lib/cups/backend/* $out/lib/cups/backend/
+  ln -s ${pkgs.gutenprintBin}/lib/cups/filter/* $out/lib/cups/filter/
+  mkdir -p $out/lib/cups/model
+  cat ${pkgs.gutenprintBin}/ppds/Canon/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd.gz |gunzip > $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
+  sed -i 's@/opt/gutenprint/cups@${pkgs.gutenprintBin}/cups@' $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
+
+Then rebuild your system and add your printer using the the localhost:603 cups web interface
+select the extracted .ppd file which can be found in the model directory of
+sed -n 's/^ServerBin //p' $(sed -n 's/respawn.*-c \(.*''\) -F.*''/\1/p' /etc/event.d/cupsd)
+(sorry, cups still doesn't see it. You could copy it into /nix/store/
+*-cups/lib/cups/model/ and you would be able to select canon -> PIXMA 4000
+then. I've tried that.
+
+TODO tidy this all up. Find source instead of binary. Fix paths ... Find out how to check ink levels etc
+
+*/
+
+stdenv.mkDerivation {
+  name = "cups-gutenprint-binary-5.0.1";
+
+  src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
+    url = https://www.openprinting.org/download/printdriver/debian/dists/lsb3.1/main/binary-amd64/gutenprint_5.0.1-1lsb3.1_amd64.deb;
+    sha256 = "0an5gba6r6v54r53s2gj2fjk8fzpl4lrksjas2333528b0k8gbbc";
+  } else throw "TODO"; # get from openprint.com -> drivers -> gutenprint
+
+  buildInputs = [ rpm cpio ];
+
+  phases = "buildPhase";
+
+  libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc zlib ];
+
+  buildPhase = ''
+    ar -x $src data.tar.gz
+    tar xfz data.tar.gz
+    cp -r opt/gutenprint $out
+
+    for p in \
+        $out/cups/lib/driver/gutenprint.5.0 \
+        $out/bin/{escputil,cups-calibrate} \
+        $out/cups/lib/driver/gutenprint.5.0 \
+        $out/cups/lib/filter/{rastertogutenprint.5.0,commandtocanon,commandtoepson} \
+        $out/cups/lib/backend/{canon,epson} \
+        $out/sbin/cups-genppd.5.0 \
+      ; do
+      patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+          --set-rpath $libPath $p
+    done
+
+    mkdir $out/lib
+    ln -s $out/cups/lib $out/lib/cups
+  '';
+
+  meta = {
+    description = "Some additional CUPS drivers including Canon drivers";
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/gutenprint/default.nix b/nixpkgs/pkgs/misc/drivers/gutenprint/default.nix
new file mode 100644
index 000000000000..7c8750905d9c
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/gutenprint/default.nix
@@ -0,0 +1,52 @@
+# this package was called gimp-print in the past
+{ stdenv, lib, fetchurl, makeWrapper, pkgconfig
+, ijs, zlib
+, gimp2Support ? false, gimp
+, cupsSupport ? true, cups, libusb, perl
+}:
+
+stdenv.mkDerivation rec {
+  name = "gutenprint-5.2.14";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gimp-print/${name}.tar.bz2";
+    sha256 = "1293x19gw1b742id7c7bz5giv3vlxaqpmbdz2g0n99wny5k0ggs5";
+  };
+
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
+  buildInputs =
+    [ ijs zlib ]
+    ++ lib.optionals gimp2Support [ gimp.gtk gimp ]
+    ++ lib.optionals cupsSupport [ cups libusb perl ];
+
+  configureFlags = lib.optionals cupsSupport [
+    "--disable-static-genppd" # should be harmless on NixOS
+  ];
+
+  # FIXME: hacky because we modify generated configure, but I haven't found a better way.
+  # makeFlags doesn't change this everywhere (e.g. in cups-genppdupdate).
+  preConfigure = lib.optionalString cupsSupport ''
+    sed -i \
+      -e "s,cups_conf_datadir=.*,cups_conf_datadir=\"$out/share/cups\",g" \
+      -e "s,cups_conf_serverbin=.*,cups_conf_serverbin=\"$out/lib/cups\",g" \
+      -e "s,cups_conf_serverroot=.*,cups_conf_serverroot=\"$out/etc/cups\",g" \
+      configure
+  '' + lib.optionalString gimp2Support ''
+    sed -i \
+      -e "s,gimp2_plug_indir=.*,gimp2_plug_indir=\"$out/lib/gimp/${gimp.majorVersion}\",g" \
+      configure
+  '';
+
+  enableParallelBuilding = true;
+
+  # Testing is very, very long.
+  # doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Ghostscript and cups printer drivers";
+    homepage = https://sourceforge.net/projects/gimp-print/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    isGutenprint = true;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix b/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix
new file mode 100644
index 000000000000..e99fe1a201d2
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix
@@ -0,0 +1,192 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, libjpeg, libusb1, pythonPackages, sane-backends, dbus, usbutils
+, net_snmp, openssl, nettools
+, bash, coreutils, utillinux
+, qtSupport ? true
+, withPlugin ? false
+}:
+
+let
+
+  name = "hplip-${version}";
+  version = "3.16.11";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/hplip/${name}.tar.gz";
+    sha256 = "094vkyr0rjng72m13dgr824cdl7q20x23qjxzih4w7l9njn0rqpn";
+  };
+
+  plugin = fetchurl {
+    url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+    sha256 = "1y3wdax2wb6kdd8bi40wl7v9s8ffyjz95bz42sjcpzzddmlhcaxg";
+  };
+
+  hplipState = substituteAll {
+    inherit version;
+    src = ./hplip.state;
+  };
+
+  hplipPlatforms = {
+    "i686-linux"   = "x86_32";
+    "x86_64-linux" = "x86_64";
+    "armv6l-linux" = "arm32";
+    "armv7l-linux" = "arm32";
+  };
+
+  hplipArch = hplipPlatforms."${stdenv.hostPlatform.system}"
+    or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+  pluginArches = [ "x86_32" "x86_64" "arm32" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+  || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+pythonPackages.buildPythonApplication {
+  inherit name src;
+  format = "other";
+
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    sane-backends
+    dbus
+    net_snmp
+    openssl
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  pythonPath = with pythonPackages; [
+    dbus
+    pillow
+    pygobject2
+    reportlab
+    usbutils
+  ] ++ stdenv.lib.optionals qtSupport [
+    pyqt4
+  ];
+
+  makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+  prePatch = ''
+    # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
+    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.dev}/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 = ''
+    export configureFlags="$configureFlags
+      --with-hpppddir=$out/share/cups/model/HP
+      --with-cupsfilterdir=$out/lib/cups/filter
+      --with-cupsbackenddir=$out/lib/cups/backend
+      --with-icondir=$out/share/applications
+      --with-systraydir=$out/xdg/autostart
+      --with-mimedir=$out/etc/cups
+      --enable-policykit
+    "
+
+    export makeFlags="
+      halpredir=$out/share/hal/fdi/preprobe/10osvendor
+      rulesdir=$out/etc/udev/rules.d
+      policykit_dir=$out/share/polkit-1/actions
+      policykit_dbus_etcdir=$out/etc/dbus-1/system.d
+      policykit_dbus_sharedir=$out/share/dbus-1/system-services
+      hplip_confdir=$out/etc/hp
+      hplip_statedir=$out/var/lib/hp
+    "
+  '';
+
+  enableParallelBuilding = true;
+
+  postInstall = stdenv.lib.optionalString withPlugin ''
+    sh ${plugin} --noexec --keep
+    cd plugin_tmp
+
+    cp plugin.spec $out/share/hplip/
+
+    mkdir -p $out/share/hplip/data/firmware
+    cp *.fw.gz $out/share/hplip/data/firmware
+
+    mkdir -p $out/share/hplip/data/plugins
+    cp license.txt $out/share/hplip/data/plugins
+
+    mkdir -p $out/share/hplip/prnt/plugins
+    for plugin in lj hbpl1; do
+      cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
+      ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
+        $out/share/hplip/prnt/plugins/$plugin.so
+    done
+
+    mkdir -p $out/share/hplip/scan/plugins
+    for plugin in bb_soap bb_marvell bb_soapht fax_marvell; do
+      cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
+      ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
+        $out/share/hplip/scan/plugins/$plugin.so
+    done
+
+    mkdir -p $out/var/lib/hp
+    cp ${hplipState} $out/var/lib/hp/hplip.state
+
+    mkdir -p $out/etc/sane.d/dll.d
+    mv $out/etc/sane.d/dll.conf $out/etc/sane.d/dll.d/hpaio.conf
+
+    rm $out/etc/udev/rules.d/56-hpmud.rules
+  '';
+
+  # The installed executables are just symlinks into $out/share/hplip,
+  # but wrapPythonPrograms ignores symlinks. We cannot replace the Python
+  # modules in $out/share/hplip with wrapper scripts because they import
+  # each other as libraries. Instead, we emulate wrapPythonPrograms by
+  # 1. Calling patchPythonProgram on the original script in $out/share/hplip
+  # 2. Making our own wrapper pointing directly to the original script.
+  dontWrapPythonPrograms = true;
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+
+    for bin in $out/bin/*; do
+      py=$(readlink -m $bin)
+      rm $bin
+      echo "patching \`$py'..."
+      patchPythonScript "$py"
+      echo "wrapping \`$bin'..."
+      makeWrapper "$py" "$bin" \
+          --prefix PATH ':' "$program_PATH" \
+          --set PYTHONNOUSERSITE "true" \
+          $makeWrapperArgs
+    done
+  '';
+
+  postFixup = ''
+    substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+  '' + stdenv.lib.optionalString (!withPlugin) ''
+    # A udev rule to notify users that they need the binary plugin.
+    # Needs a lot of patching but might save someone a bit of confusion:
+    substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+      --replace {,${bash}}/bin/sh \
+      --replace {/usr,${coreutils}}/bin/nohup \
+      --replace {,${utillinux}/bin/}logger \
+      --replace {/usr,$out}/bin
+  '';
+
+  meta = with stdenv.lib; {
+    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 = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ];
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/hplip/default.nix b/nixpkgs/pkgs/misc/drivers/hplip/default.nix
new file mode 100644
index 000000000000..ea9554288091
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/default.nix
@@ -0,0 +1,225 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, zlib, libjpeg, libusb1, pythonPackages, sane-backends
+, dbus, file, ghostscript, usbutils
+, net_snmp, openssl, perl, nettools
+, bash, coreutils, utillinux
+, withQt5 ? true
+, withPlugin ? false
+, withStaticPPDInstall ? false
+}:
+
+let
+
+  name = "hplip-${version}";
+  version = "3.19.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/hplip/${name}.tar.gz";
+    sha256 = "1kl1q4753xx1w76dhp92wgrhn5k1yx1ib35pyi0vi3mw0njbhrzm";
+  };
+
+  plugin = fetchurl {
+    url = "https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+    sha256 = "1fwjypy1ycyi7rr1vk1yxhbdhx51n7fxhvjb36mzw8qz71dif2i3";
+  };
+
+  hplipState = substituteAll {
+    inherit version;
+    src = ./hplip.state;
+  };
+
+  hplipPlatforms = {
+    "i686-linux"   = "x86_32";
+    "x86_64-linux" = "x86_64";
+    "armv6l-linux" = "arm32";
+    "armv7l-linux" = "arm32";
+  };
+
+  hplipArch = hplipPlatforms."${stdenv.hostPlatform.system}"
+    or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+  pluginArches = [ "x86_32" "x86_64" "arm32" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+  || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+pythonPackages.buildPythonApplication {
+  inherit name src;
+  format = "other";
+
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    sane-backends
+    dbus
+    file
+    ghostscript
+    net_snmp
+    openssl
+    perl
+    zlib
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  pythonPath = with pythonPackages; [
+    dbus
+    pillow
+    pygobject2
+    reportlab
+    usbutils
+    sip
+  ] ++ stdenv.lib.optionals withQt5 [
+    pyqt5
+    enum-compat
+  ];
+
+  makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+  prePatch = ''
+    # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
+    find . -type f -exec sed -i \
+      -e s,/etc/hp,$out/etc/hp,g \
+      -e s,/etc/sane.d,$out/etc/sane.d,g \
+      -e s,/usr/include/libusb-1.0,${libusb1.dev}/include/libusb-1.0,g \
+      -e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor,g \
+      -e s,/usr/lib/systemd/system,$out/lib/systemd/system,g \
+      -e s,/var/lib/hp,$out/var/lib/hp,g \
+      -e s,/usr/bin/perl,${perl}/bin/perl,g \
+      -e s,/usr/bin/file,${file}/bin/file,g \
+      -e s,/usr/bin/gs,${ghostscript}/bin/gs,g \
+      -e s,/usr/share/cups/fonts,${ghostscript}/share/ghostscript/fonts,g \
+      -e "s,ExecStart=/usr/bin/python /usr/bin/hp-config_usb_printer,ExecStart=$out/bin/hp-config_usb_printer,g" \
+      {} +
+  '';
+
+  preConfigure = ''
+    export configureFlags="$configureFlags
+      --with-hpppddir=$out/share/cups/model/HP
+      --with-cupsfilterdir=$out/lib/cups/filter
+      --with-cupsbackenddir=$out/lib/cups/backend
+      --with-icondir=$out/share/applications
+      --with-systraydir=$out/xdg/autostart
+      --with-mimedir=$out/etc/cups
+      --enable-policykit
+      ${stdenv.lib.optionalString withStaticPPDInstall "--enable-cups-ppd-install"}
+      --disable-qt4
+      ${stdenv.lib.optionalString withQt5 "--enable-qt5"}
+    "
+
+    export makeFlags="
+      halpredir=$out/share/hal/fdi/preprobe/10osvendor
+      rulesdir=$out/etc/udev/rules.d
+      policykit_dir=$out/share/polkit-1/actions
+      policykit_dbus_etcdir=$out/etc/dbus-1/system.d
+      policykit_dbus_sharedir=$out/share/dbus-1/system-services
+      hplip_confdir=$out/etc/hp
+      hplip_statedir=$out/var/lib/hp
+    "
+
+    # Prevent 'ppdc: Unable to find include file "<font.defs>"' which prevent
+    # generation of '*.ppd' files.
+    # This seems to be a 'ppdc' issue when the tool is run in a hermetic sandbox.
+    # Could not find how to fix the problem in 'ppdc' so this is a workaround.
+    export CUPS_DATADIR="${cups}/share/cups"
+  '';
+
+  enableParallelBuilding = true;
+
+  #
+  # Running `hp-diagnose_plugin -g` can be used to diagnose
+  # issues with plugins.
+  #
+  postInstall = stdenv.lib.optionalString withPlugin ''
+    sh ${plugin} --noexec --keep
+    cd plugin_tmp
+
+    cp plugin.spec $out/share/hplip/
+
+    mkdir -p $out/share/hplip/data/firmware
+    cp *.fw.gz $out/share/hplip/data/firmware
+
+    mkdir -p $out/share/hplip/data/plugins
+    cp license.txt $out/share/hplip/data/plugins
+
+    mkdir -p $out/share/hplip/prnt/plugins
+    for plugin in lj hbpl1; do
+      cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
+      chmod 0755 $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so
+      ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
+        $out/share/hplip/prnt/plugins/$plugin.so
+    done
+
+    mkdir -p $out/share/hplip/scan/plugins
+    for plugin in bb_soap bb_marvell bb_soapht bb_escl; do
+      cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
+      chmod 0755 $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so
+      ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
+        $out/share/hplip/scan/plugins/$plugin.so
+    done
+
+    mkdir -p $out/share/hplip/fax/plugins
+    for plugin in fax_marvell; do
+      cp $plugin-${hplipArch}.so $out/share/hplip/fax/plugins
+      chmod 0755 $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so
+      ln -s $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so \
+        $out/share/hplip/fax/plugins/$plugin.so
+    done
+
+    mkdir -p $out/var/lib/hp
+    cp ${hplipState} $out/var/lib/hp/hplip.state
+
+    rm $out/etc/udev/rules.d/56-hpmud.rules
+  '';
+
+  # The installed executables are just symlinks into $out/share/hplip,
+  # but wrapPythonPrograms ignores symlinks. We cannot replace the Python
+  # modules in $out/share/hplip with wrapper scripts because they import
+  # each other as libraries. Instead, we emulate wrapPythonPrograms by
+  # 1. Calling patchPythonProgram on the original script in $out/share/hplip
+  # 2. Making our own wrapper pointing directly to the original script.
+  dontWrapPythonPrograms = true;
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+
+    for bin in $out/bin/*; do
+      py=$(readlink -m $bin)
+      rm $bin
+      echo "patching \`$py'..."
+      patchPythonScript "$py"
+      echo "wrapping \`$bin'..."
+      makeWrapper "$py" "$bin" \
+          --prefix PATH ':' "$program_PATH" \
+          --set PYTHONNOUSERSITE "true" \
+          $makeWrapperArgs
+    done
+  '';
+
+  postFixup = ''
+    substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+  '' + stdenv.lib.optionalString (!withPlugin) ''
+    # A udev rule to notify users that they need the binary plugin.
+    # Needs a lot of patching but might save someone a bit of confusion:
+    substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+      --replace {,${bash}}/bin/sh \
+      --replace {/usr,${coreutils}}/bin/nohup \
+      --replace {,${utillinux}/bin/}logger \
+      --replace {/usr,$out}/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Print, scan and fax HP drivers for Linux";
+    homepage = https://developers.hp.com/hp-linux-imaging-and-printing;
+    license = if withPlugin
+      then licenses.unfree
+      else with licenses; [ mit bsd2 gpl2Plus ];
+    platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ];
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/hplip/hplip.state b/nixpkgs/pkgs/misc/drivers/hplip/hplip.state
new file mode 100644
index 000000000000..9d19a93f3644
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/hplip.state
@@ -0,0 +1,4 @@
+[plugin]
+installed=1
+eula=1
+version=@version@
diff --git a/nixpkgs/pkgs/misc/drivers/m33-linux/default.nix b/nixpkgs/pkgs/misc/drivers/m33-linux/default.nix
new file mode 100644
index 000000000000..492488f675f2
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/m33-linux/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+  name = "M33-Linux-2016-06-23";
+
+  src = fetchFromGitHub {
+    owner = "donovan6000";
+    repo = "M3D-Linux";
+    rev = "5c1b90c13d260771dac970b49fdc9f840fee5f4a";
+    sha256 = "1bvbclkyfcv23vxb4s1zssvygklks1nhp4iwi4v90c1fvyz0356f";
+  };
+
+  installPhase = ''
+    install -Dm755 m33-linux $out/bin/m33-linux
+    install -Dm755 90-micro-3d-local.rules $out/lib/udev/rules.d/90-micro-3d-local.rules
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/donovan6000/M3D-Linux;
+    description = "A Linux program that can communicate with the Micro 3D printer";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/moltengamepad/default.nix b/nixpkgs/pkgs/misc/drivers/moltengamepad/default.nix
new file mode 100644
index 000000000000..31b13baf7964
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/moltengamepad/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, udev }:
+
+stdenv.mkDerivation rec {
+  name = "moltengamepad-git-${version}";
+  version = "2016-05-04";
+
+  src = fetchFromGitHub {
+    owner = "jgeumlek";
+    repo = "MoltenGamepad";
+    rev = "6656357964c22be97227fc5353b53c6ab1e69929";
+    sha256 = "05cpxfzxgm86kxx0a9f76bshjwpz9w1g8bn30ib1i5a3fv7bmirl";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  buildInputs = [ udev ];
+
+  buildPhase = ''
+    make
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp moltengamepad $out/bin
+  '';
+
+  patchPhase = ''
+    sed -i -e '159d;161d;472d;473d;474d;475d' source/eventlists/key_list.cpp
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/jgeumlek/MoltenGamepad;
+    description = "Flexible Linux input device translator, geared for gamepads";
+    license = licenses.mit;
+    maintainers = [ maintainers.ebzzry ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/misc/drivers/postscript-lexmark/default.nix b/nixpkgs/pkgs/misc/drivers/postscript-lexmark/default.nix
new file mode 100644
index 000000000000..a7d5710a2793
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/postscript-lexmark/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, rpmextract }:
+let
+  version = "20160218";
+in
+stdenv.mkDerivation {
+  name = "postscript-lexmark-${version}";
+
+  src = fetchurl {
+    url = "https://www.openprinting.org/download/printdriver/components/lsb3.2/main/RPMS/noarch/openprinting-ppds-postscript-lexmark-${version}-1lsb3.2.noarch.rpm";
+    sha256 = "0wbhvypdr96a5ddg6kj41dn9sbl49n7pfi2vs762ij82hm2gvwcm";
+  };
+
+  nativeBuildInputs = [ rpmextract ];
+
+  phases = [ "unpackPhase" "installPhase"];
+
+  sourceRoot = ".";
+
+  unpackPhase = ''
+    rpmextract $src
+    for ppd in opt/OpenPrinting-Lexmark/ppds/Lexmark/*; do
+      gzip -d $ppd
+    done
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/cups/model/postscript-lexmark
+    cp opt/OpenPrinting-Lexmark/ppds/Lexmark/*.ppd $out/share/cups/model/postscript-lexmark/
+    cp -r opt/OpenPrinting-Lexmark/doc $out/doc
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.openprinting.org/driver/Postscript-Lexmark/;
+    description = "Lexmark Postscript Drivers";
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/sc-controller/default.nix b/nixpkgs/pkgs/misc/drivers/sc-controller/default.nix
new file mode 100644
index 000000000000..764e60ac13ba
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/sc-controller/default.nix
@@ -0,0 +1,63 @@
+{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook
+, gtk3, gobject-introspection, libappindicator-gtk3, librsvg
+, evdev, pygobject3, pylibacl, pytest, bluez
+, linuxHeaders
+, libX11, libXext, libXfixes, libusb1, udev
+}:
+
+buildPythonApplication rec {
+  pname = "sc-controller";
+  version = "0.4.6.1";
+
+  src = fetchFromGitHub {
+    owner  = "kozec";
+    repo   = pname;
+    rev    = "v${version}";
+    sha256 = "1kcqsnrlwl4s94j6ahgkz3w4sy9hsr95y624zab6g10w0fl5sqrc";
+  };
+
+  nativeBuildInputs = [ wrapGAppsHook ];
+
+  buildInputs = [ gtk3 gobject-introspection libappindicator-gtk3 librsvg ];
+
+  propagatedBuildInputs = [ evdev pygobject3 pylibacl ];
+
+  checkInputs = [ pytest ];
+
+  postPatch = ''
+    substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
+    substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
+    substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
+  '';
+
+  LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 udev bluez ];
+
+  preFixup = ''
+    gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
+    # gdk-pixbuf setup hook can not choose between propagated librsvg
+    # and our librsvg with GObject introspection.
+    GDK_PIXBUF_MODULE_FILE=$(echo ${librsvg}/lib/gdk-pixbuf-2.0/*/loaders.cache)
+  '';
+
+  postFixup = ''
+    (
+      # scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
+      cd $out/lib/python*/site-packages/scc/x11
+      patchPythonScript scc-autoswitch-daemon.py
+      patchPythonScript scc-osd-daemon.py
+    )
+  '';
+
+  checkPhase = ''
+    PYTHONPATH=. py.test
+  '';
+
+  meta = with lib; {
+    homepage    = https://github.com/kozec/sc-controller;
+    # donations: https://www.patreon.com/kozec
+    description = "User-mode driver and GUI for Steam Controller and other controllers";
+    license     = licenses.gpl2;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ orivej rnhmjoj ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/steamcontroller/default.nix b/nixpkgs/pkgs/misc/drivers/steamcontroller/default.nix
new file mode 100644
index 000000000000..d44c90d198a9
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/steamcontroller/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, lib, fetchFromGitHub, python3Packages, libusb1, linuxHeaders
+, GyroplotSupport ? false
+}:
+
+with python3Packages;
+
+buildPythonApplication rec {
+  name = "steamcontroller-${version}";
+  version = "2017-08-11";
+
+  src = fetchFromGitHub {
+    owner  = "ynsta";
+    repo   = "steamcontroller";
+    rev    = "80928ce237925e0d0d7a65a45b481435ba6b931e";
+    sha256 = "0lv9j2zv8fmkmc0x9r7fa8zac2xrwfczms35qz1nfa1hr84wniid";
+  };
+
+  postPatch = ''
+    substituteInPlace src/uinput.py --replace \
+      "/usr/include" "${linuxHeaders}/include"
+  '';
+
+  buildInputs = [ libusb1 ];
+  propagatedBuildInputs =
+    [ psutil python3Packages.libusb1 ]
+    ++ lib.optionals GyroplotSupport [ pyqtgraph pyside ];
+
+  meta = with stdenv.lib; {
+    description = "A standalone Steam controller driver";
+    homepage    = https://github.com/ynsta/steamcontroller;
+    license     = licenses.mit;
+    maintainers = with maintainers; [ rnhmjoj ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/sundtek/default.nix b/nixpkgs/pkgs/misc/drivers/sundtek/default.nix
new file mode 100644
index 000000000000..35a9bd2e3844
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/sundtek/default.nix
@@ -0,0 +1,50 @@
+{ fetchurl, stdenv }:
+
+with stdenv.lib;
+
+let
+  version = "2016-01-26";
+  rpath = makeLibraryPath [ "$out/lib" "$out/bin" ];
+  platform = with stdenv;
+    if isx86_64 then "64bit"
+    else
+    if isi686 then "32bit"
+    else throw "${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 = "15y6r5w306pcq4g1rn9f7vf70f3a7qhq237ngaf0wxh2nr0aamxp";
+    };
+    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} {} \;
+    '';
+
+    preferLocalBuild = true;
+
+    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/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix b/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix
new file mode 100644
index 000000000000..c942ec59f37e
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, scons, libX11, pkgconfig
+, libusb1, boost, glib, dbus-glib }:
+
+let
+  version = "0.8.8";
+in stdenv.mkDerivation {
+  name = "xboxdrv-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/xboxdrv/xboxdrv/archive/v${version}.tar.gz";
+    sha256 = "0jx2wqmc7602dxyj19n3h8x0cpy929h7c0h39vcc5rf0q74fh3id";
+  };
+
+  makeFlags = "PREFIX=$(out)";
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ scons libX11 libusb1 boost glib dbus-glib ];
+  dontUseSconsInstall = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://pingus.seul.org/~grumbel/xboxdrv/;
+    description = "Xbox/Xbox360 (and more) gamepad driver for Linux that works in userspace";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.fuuzetsu ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/misc/drivers/xwiimote/default.nix b/nixpkgs/pkgs/misc/drivers/xwiimote/default.nix
new file mode 100644
index 000000000000..a21584afa4c2
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/xwiimote/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, udev, ncurses, pkgconfig, fetchurl, bluez }:
+
+stdenv.mkDerivation rec {
+  name = "xwiimote-2";
+  src = fetchurl {
+    url = "https://github.com/dvdhrm/xwiimote/releases/download/${name}/${name}.tar.xz";
+    sha256 = "1g9cbhblll47l300zr999xr51x2g98y49l222f77fhswd12kjzhd";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ udev ncurses bluez ];
+
+  configureFlags = [ "--with-doxygen=no" ];
+
+  meta = {
+    homepage = http://dvdhrm.github.io/xwiimote;
+    description = "Userspace utilities to control connected Nintendo Wii Remotes";
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.mit;
+  };
+
+  postInstallPhase = ''
+    mkdir -p "$out/etc/X11/xorg.conf.d/"
+    cp "res/50-xorg-fix-xwiimote.conf" "$out/etc/X11/xorg.conf.d/50-fix-xwiimote.conf"
+  '';
+}