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.nix282
-rw-r--r--nixpkgs/pkgs/misc/drivers/epkowa/firmware_location.patch20
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix77
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-alc1100/cups-data-dir.patch13
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix71
-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.nix49
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr2/cups-filter-ppd-dirs.patch55
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix44
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix102
-rw-r--r--nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix77
-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.nix40
-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/3.18.5.nix224
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/default.nix231
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/hplip.state4
-rw-r--r--nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch115
-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.nix38
-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.nix51
-rw-r--r--nixpkgs/pkgs/misc/drivers/utsushi/default.nix138
-rw-r--r--nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix28
-rw-r--r--nixpkgs/pkgs/misc/drivers/xwiimote/default.nix26
32 files changed, 2407 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..13bb63ca7091
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epkowa/default.nix
@@ -0,0 +1,282 @@
+{stdenv, fetchurl, fetchpatch, makeWrapper, symlinkJoin,
+pkgconfig, libtool,
+gtk2,
+libxml2,
+libxslt,
+libusb,
+sane-backends,
+rpm, cpio,
+getopt,
+patchelf, autoPatchelfHook, 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 = "2.30.4";
+
+    src = fetchurl {
+      # To find new versions, visit
+      # http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
+      # some printer like for instance "WF-7210" to get to the most recent
+      # version.  
+      # NOTE: Don't forget to update the webarchive link too!
+      urls = [
+        "https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
+        "https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
+      ];
+      sha256 = "16iq5gmfcgkvcx5hixggxgb8lwin5gjdhnq0zabgpfqg11n2w21q";
+    };
+
+    nativeBuildInputs = [ autoPatchelfHook rpm ];
+
+    installPhase = ''
+      ${rpm}/bin/rpm2cpio plugins/esci-interpreter-perfection-v330-*.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
+      '';
+
+    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 = "2.30.4";
+
+    nativeBuildInputs = [ autoPatchelfHook rpm ];
+    src = fetchurl {
+      urls = [
+        "https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
+        "https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
+      ];
+      sha256 = "1cz4z3wz216s77z185m665jcgdslil5gn4dsi118nv1fm17z3jik";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio iscan-plugin-gt-x770-*.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
+      '';
+    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 = "2.30.4";
+
+    nativeBuildInputs= [ autoPatchelfHook ];
+    buildInputs = [ gcc.cc.lib ];
+    src = fetchurl {
+      urls = [
+        "https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
+        "https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
+      ];
+      sha256 = "12rivh00n9mhagy5yjl1m0bv7ypbig6brqkxm0a12xy0mjq7yv8y";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio esci-interpreter-gt-f720-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/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 = "2.30.4";
+
+    nativeBuildInputs = [ autoPatchelfHook ];
+    buildInputs = [ gcc.cc.lib libtool ];
+    src = fetchurl {
+      urls = [
+        "https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
+        "https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
+      ];
+      sha256 = "1ran75zsxcdci00jakngkz6p9lj4q483hjapmf80p68rzhpmdr5y";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio esci-interpreter-gt-s80-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      ${rpm}/bin/rpm2cpio iscan-plugin-esdip-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/lib
+      mkdir $out/share/esci
+      '';
+
+    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; };
+  };
+  network = stdenv.mkDerivation rec {
+    pname = "iscan-nt-bundle";
+    # for the version, look for the driver of XP-750 in the search page
+    version = "2.30.4";
+
+    buildInputs = [ stdenv.cc.cc.lib ];
+    nativeBuildInputs = [ autoPatchelfHook ];
+
+    src = fetchurl {
+      urls = [
+        "https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
+        "https://web.archive.org/web/https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
+      ];
+      sha256 = "1l0y4dy88y91jdq66pxrxqmiwsxwy0rd7x4bh0cw08r4iyhjqprz";
+    };
+    installPhase = ''
+      cd plugins
+      ${rpm}/bin/rpm2cpio iscan-network-nt-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
+
+      mkdir $out
+      cp -r usr/share $out
+      cp -r usr/lib64 $out/lib
+      mkdir $out/share/esci
+      '';
+    passthru = {
+      registrationCommand = "";
+      hw = "network";
+    };
+
+    meta = common_meta // { description = "iscan network plugin"; };
+  };
+};
+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 {
+  pname = "iscan-data";
+  version = "1.39.1-2";
+
+  src = fetchurl {
+    urls = [
+      "http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
+      "https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
+    ];
+    sha256 = "04zrvbnxf1k6zinrd13hwnbzscc3qhmwlvx3k2jhjys2lginw7w4";
+  };
+
+  buildInputs = [
+    libxslt
+  ];
+
+  meta = common_meta;
+};
+in
+stdenv.mkDerivation rec {
+  pname = "iscan";
+  version = "2.30.4-2";
+
+  src = fetchurl {
+    urls = [
+      "http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
+      "https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
+    ];
+    sha256 = "1ma76jj0k3bz0fy06fiyl4di4y77rcryb0mwjmzs5ms2vq9rjysr";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gtk2
+    libxml2
+    libtool
+    libusb
+    sane-backends
+    makeWrapper
+  ];
+
+  patches = [
+    (fetchpatch {
+      urls = [
+        "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf"
+        "https://web.archive.org/web/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 = [ "--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
+    mkdir -p $out/lib/iscan
+    ln -s ${plugins.network}/lib/iscan/network $out/lib/iscan/network
+    '';
+  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..448bac92ae80
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-201106w/default.nix
@@ -0,0 +1,77 @@
+{ stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
+
+let
+  version = "1.0.1";
+  filterVersion = "1.0.0";
+in
+  stdenv.mkDerivation {
+
+    pname = "epson-201106w";
+    inherit version;
+
+    src = fetchurl {
+      # NOTE: Don't forget to update the webarchive link too!
+      urls = [
+        "https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201106w-${version}-1lsb3.2.src.rpm"
+        "https://web.archive.org/web/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..fe52b104a528
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-alc1100/default.nix
@@ -0,0 +1,71 @@
+{ 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 {
+    pname = "epson-alc1100";
+    inherit 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..b9f198b14b74
--- /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 12b4662..6ec641c 100755
+--- a/configure
++++ b/configure_new
+@@ -12162,55 +12162,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"
+ 
+ # Check whether --enable-lsb was given.
+ if test "${enable_lsb+set}" = set; then :
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..d90ef2c91f64
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, cups }:
+
+stdenv.mkDerivation {
+  pname = "epson-escpr";
+  version = "1.7.3";
+
+  src = fetchurl {
+    # To find new versions, visit
+    # http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
+    # some printer like for instance "WF-7110" to get to the most recent
+    # version.  
+    # NOTE: Don't forget to update the webarchive link too!
+    urls = [
+      "https://download3.ebz.epson.net/dsc/f/03/00/09/83/26/f90d0f70b33a9d7d77a2408364c47fba1ccbf943/epson-inkjet-printer-escpr-1.7.3-1lsb3.2.tar.gz"
+      "https://web.archive.org/web/https://download3.ebz.epson.net/dsc/f/03/00/09/83/26/f90d0f70b33a9d7d77a2408364c47fba1ccbf943/epson-inkjet-printer-escpr-1.7.3-1lsb3.2.tar.gz"
+    ];
+    sha256 = "0r3jkdfk33irha9gpyvhha056ans59p7dq9i153i292ifjsd8458";
+  };
+
+  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..4edc08a3571b
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-escpr2/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, cups, busybox }:
+
+stdenv.mkDerivation rec {
+  pname = "epson-inkjet-printer-escpr2";
+  version = "1.1.1";
+
+  src = fetchurl {
+    # To find new versions, visit
+    # http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
+    # some printer like for instance "WF-7210" to get to the most recent
+    # version.  
+    # NOTE: Don't forget to update the webarchive link too!
+    urls = [ 
+      "https://download3.ebz.epson.net/dsc/f/03/00/09/72/04/c6d928e83e558c4ba1e7e8bcb5c1fe080b8095eb/epson-inkjet-printer-escpr2-1.1.1-1lsb3.2.src.rpm"
+      "https://web.archive.org/web/https://download3.ebz.epson.net/dsc/f/03/00/09/72/04/c6d928e83e558c4ba1e7e8bcb5c1fe080b8095eb/epson-inkjet-printer-escpr2-1.1.1-1lsb3.2.src.rpm"
+    ];
+    sha256 = "02vdlhvinsx6vsjq172b2c1vrfzkg0w9j5lbsnjvj6yq3yqz5b5q";
+  };
+
+  patches = [ ./cups-filter-ppd-dirs.patch ];
+
+  buildInputs = [ cups busybox ];
+
+  unpackPhase = ''
+    rpm2cpio $src | cpio -idmv
+
+    tar xvf ${pname}-${version}-1lsb3.2.tar.gz
+    cd ${pname}-${version}
+  '';
+
+  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..0cc5537180bd
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson-workforce-635-nx625-series/default.nix
@@ -0,0 +1,102 @@
+{
+  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 {
+    # NOTE: Don't forget to update the webarchive link too!
+    urls = [
+      "https://download.ebz.epson.net/dsc/op/stable/SRPMS/${name}-${version}-1lsb3.2.src.rpm"
+      "https://web.archive.org/web/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..fc854c007962
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/epson_201207w/default.nix
@@ -0,0 +1,77 @@
+{ stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
+
+let
+  version = "1.0.0";
+in
+  stdenv.mkDerivation {
+
+    pname = "epson_201207w";
+    inherit version;
+
+    src = fetchurl {
+      # NOTE: Don't forget to update the webarchive link too!
+      urls = [
+        "https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201207w-${version}-1lsb3.2.src.rpm"
+        "https://web.archive.org/web/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..9bee05bfb254
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/foomatic-filters/default.nix
@@ -0,0 +1,40 @@
+{ 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://salsa.debian.org/debian/foomatic-filters/raw/a3abbef2d2f8c7e62d2fe64f64afe294563fdf8f/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..3b03c300db3f
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix
@@ -0,0 +1,192 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, libjpeg, libusb1, python2Packages, 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";
+    aarch64-linux = "arm64";
+  };
+
+  hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+    or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+  pluginArches = [ "x86_32" "x86_64" "arm32" "arm64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+  || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python2Packages.buildPythonApplication {
+  inherit name src;
+  format = "other";
+
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    sane-backends
+    dbus
+    net-snmp
+    openssl
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  pythonPath = with python2Packages; [
+    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
+  '';
+
+  # 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
+    # Patch udev rules:
+    # with plugin, they upload firmware to printers,
+    # without plugin, they complain about the missing plugin.
+    substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+      --replace {,${bash}}/bin/sh \
+      --replace /usr/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/;
+    downloadPage = https://sourceforge.net/projects/hplip/files/hplip/;
+    license = if withPlugin
+      then licenses.unfree
+      else with licenses; [ mit bsd2 gpl2Plus ];
+    platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix b/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix
new file mode 100644
index 000000000000..ab1794c12514
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix
@@ -0,0 +1,224 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, zlib, libjpeg, libusb1, python2Packages, 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.18.5";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/hplip/${name}.tar.gz";
+    sha256 = "0xb7ga2wgbwjxsss67mjn2y6fmqsfwzmv11ivvfzhnl36lh22hkb";
+  };
+
+  plugin = fetchurl {
+    url = "https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+    sha256 = "1jf74jya071zqvwhy9n0c3007pzgcxydkw7qdh4sx70brly81i7p";
+  };
+
+  hplipState = substituteAll {
+    inherit version;
+    src = ./hplip.state;
+  };
+
+  hplipPlatforms = {
+    i686-linux    = "x86_32";
+    x86_64-linux  = "x86_64";
+    armv6l-linux  = "arm32";
+    armv7l-linux  = "arm32";
+    aarch64-linux = "arm64";
+  };
+
+  hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+    or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+  pluginArches = [ "x86_32" "x86_64" "arm32" "arm64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+  || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python2Packages.buildPythonApplication {
+  inherit name src;
+  format = "other";
+
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    sane-backends
+    dbus
+    file
+    ghostscript
+    net-snmp
+    openssl
+    perl
+    zlib
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  pythonPath = with python2Packages; [
+    dbus
+    pillow
+    pygobject2
+    reportlab
+    usbutils
+    sip
+  ] ++ stdenv.lib.optionals withQt5 [
+    pyqt5
+  ];
+
+  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
+  '';
+
+  # 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
+    # Patch udev rules:
+    # with plugin, they upload firmware to printers,
+    # without plugin, they complain about the missing plugin.
+    substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+      --replace {,${bash}}/bin/sh \
+      --replace /usr/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;
+    downloadPage = https://sourceforge.net/projects/hplip/files/hplip/;
+    license = if withPlugin
+      then licenses.unfree
+      else with licenses; [ mit bsd2 gpl2Plus ];
+    platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+    maintainers = with maintainers; [ jgeerds 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..1514e8def970
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/default.nix
@@ -0,0 +1,231 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, zlib, libjpeg, libusb1, python3Packages, 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.12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/hplip/${name}.tar.gz";
+    sha256 = "0mdj0sqgfxjqa550adiw1gn4z9n6wcvn55slivgf0ndn5x89iwxp";
+  };
+
+  plugin = fetchurl {
+    url = "https://developers.hp.com/sites/default/files/${name}-plugin.run";
+    sha256 = "1fn8h1a5znjqjh071ifjdywr0xswc14286gwy6h9vvlh8hzrz347";
+  };
+
+  hplipState = substituteAll {
+    inherit version;
+    src = ./hplip.state;
+  };
+
+  hplipPlatforms = {
+    i686-linux   = "x86_32";
+    x86_64-linux = "x86_64";
+    armv6l-linux = "arm32";
+    armv7l-linux = "arm32";
+    aarch64-linux = "aarch64";
+  };
+
+  hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+    or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+  pluginArches = [ "x86_32" "x86_64" "arm32" "aarch64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+  || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python3Packages.buildPythonApplication {
+  inherit name src;
+  format = "other";
+
+  buildInputs = [
+    libjpeg
+    cups
+    libusb1
+    sane-backends
+    dbus
+    file
+    ghostscript
+    net-snmp
+    openssl
+    perl
+    zlib
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  pythonPath = with python3Packages; [
+    dbus
+    pillow
+    pygobject2
+    reportlab
+    usbutils
+    sip
+    dbus-python
+  ] ++ stdenv.lib.optionals withQt5 [
+    pyqt5
+    enum-compat
+  ];
+
+  makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+  patches = [
+    # remove ImageProcessor usage, it causes segfaults, see
+    # https://bugs.launchpad.net/hplip/+bug/1788706
+    # https://bugs.launchpad.net/hplip/+bug/1787289
+    ./image-processor.patch
+  ];
+
+  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
+  '';
+
+  # 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
+    # Patch udev rules:
+    # with plugin, they upload firmware to printers,
+    # without plugin, they complain about the missing plugin.
+    substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+      --replace {,${bash}}/bin/sh \
+      --replace /usr/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;
+    downloadPage = https://sourceforge.net/projects/hplip/files/hplip/;
+    license = if withPlugin
+      then licenses.unfree
+      else with licenses; [ mit bsd2 gpl2Plus ];
+    platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-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/hplip/image-processor.patch b/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch
new file mode 100644
index 000000000000..30df1d29d97e
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch
@@ -0,0 +1,115 @@
+From 207aa582477dd874d1651db2d0654c5d6adb6e0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Fri, 20 Dec 2019 13:13:52 +0000
+Subject: [PATCH] remove imageprocessor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
+---
+ Makefile.am                  |  4 ++--
+ Makefile.in                  |  2 +-
+ prnt/hpcups/HPCupsFilter.cpp | 19 -------------------
+ 3 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 891660d..484a051 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -166,7 +166,7 @@ if !HPLIP_CLASS_DRIVER
+ dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py
+ endif #HPLIP_CLASS_DRIVER
+ 
+-dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so
++dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template
+ dist_noinst_SCRIPTS += dat2drv.py install.py  hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv
+ 
+ if !HPLIP_CLASS_DRIVER
+@@ -594,7 +594,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
+ 	prnt/hpcups/ImageProcessor.h
+ 
+ hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+diff --git a/Makefile.in b/Makefile.in
+index 16c39f0..46a767e 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4814,7 +4814,7 @@ libapdk_la_CFLAGS = $(libapdk_la_CXXFLAGS) -Iprnt/hpijs
+ @HPCUPS_INSTALL_TRUE@	prnt/hpcups/ImageProcessor.h
+ 
+ @HPCUPS_INSTALL_TRUE@hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+diff --git a/prnt/hpcups/HPCupsFilter.cpp b/prnt/hpcups/HPCupsFilter.cpp
+index 5b282d8..153ee3a 100644
+--- a/prnt/hpcups/HPCupsFilter.cpp
++++ b/prnt/hpcups/HPCupsFilter.cpp
+@@ -31,7 +31,6 @@
+ \*****************************************************************************/
+ 
+ #include "HPCupsFilter.h"
+-#include "ImageProcessor.h"
+ 
+ #include <signal.h>
+ #include <sys/wait.h>
+@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ 
+ 
+     sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
+-    image_processor_t* imageProcessor = imageProcessorCreate();
+ 
+     while (cupsRasterReadHeader2(cups_raster, &cups_header))
+     {
+ 
+-        IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header);
+-        if (result != IPE_SUCCESS){
+-            dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result);
+-        }
+-
+         current_page_number++;
+ 
+         if (current_page_number == 1) {
+@@ -745,11 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             color_raster = rgbRaster;
+             black_raster = kRaster;
+ 
+-            result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine);
+-            if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result);
+-            }
+-
+ 
+             if ((y == 0) && !is_ljmono) {
+                 //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer
+@@ -780,11 +768,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             }
+         }  // for() loop end
+ 
+-        result = imageProcessorEndPage(imageProcessor);
+-        if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result);
+-        }
+-
+ 
+         m_Job.NewPage();
+         if (err != NO_ERROR) {
+@@ -800,8 +783,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+         rgbRaster = NULL;
+     }
+ 
+-    imageProcessorDestroy(imageProcessor);
+-
+     unlink(hpPreProcessedRasterFile);
+     return ret_status;
+ }
+-- 
+2.24.1
+
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..2dd32a93219d
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/moltengamepad/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, udev }:
+
+stdenv.mkDerivation {
+  pname = "moltengamepad-git";
+  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..cd322bf8fdb7
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/postscript-lexmark/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, rpmextract }:
+let
+  version = "20160218";
+in
+stdenv.mkDerivation {
+  pname = "postscript-lexmark";
+  inherit 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..b977b2c0c15e
--- /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.7";
+
+  src = fetchFromGitHub {
+    owner  = "kozec";
+    repo   = pname;
+    rev    = "v${version}";
+    sha256 = "1dskjh5qcjf4x21n4nk1zvdfivbgimsrc2lq1id85bibzps29499";
+  };
+
+  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..4b19932450ec
--- /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 {
+  pname = "steamcontroller";
+  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..be199936426c
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/sundtek/default.nix
@@ -0,0 +1,51 @@
+{ 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";
+    };
+    pname = "sundtek";
+    inherit 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/utsushi/default.nix b/nixpkgs/pkgs/misc/drivers/utsushi/default.nix
new file mode 100644
index 000000000000..ad7659d060a3
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/utsushi/default.nix
@@ -0,0 +1,138 @@
+{ stdenv, fetchFromGitLab, autoreconfHook, pkg-config, boost, gtkmm2
+, imagemagick, sane-backends, tesseract4, udev, libusb}:
+
+stdenv.mkDerivation rec {
+  pname = "utsushi";
+  version = "3.59.2";
+
+  src = fetchFromGitLab{
+    owner = pname;
+    repo = "imagescan";
+    rev = version;
+    sha256 = "06gp97dfnf43l6kb988scmm66q9n5rc7ndwv3rykrdpyhy8rbi05";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    boost.dev
+    gtkmm2.dev
+    imagemagick
+    sane-backends
+    udev.dev
+    libusb.dev
+  ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations -Wno-error=parentheses -Wno-error=unused-variable";
+
+  postPatch = ''
+    # remove vendored dependencies
+    rm -r upstream/boost
+
+    # create fake udev and sane config
+    mkdir -p $out/etc/{sane.d,udev/rules.d}
+    touch $out/etc/sane.d/dll.conf
+
+    # absolute paths to conver & tesseract
+    substituteInPlace filters/magick.cpp \
+      --replace '"convert' '"${imagemagick}/bin/convert'
+    substituteInPlace filters/reorient.cpp \
+      --replace '"tesseract' '"${tesseract4}/bin/tesseract'
+    substituteInPlace filters/get-text-orientation \
+      --replace '=tesseract' '=${tesseract4}/bin/tesseract'
+  '';
+
+  configureFlags = [
+    "--with-boost-libdir=${boost}/lib"
+    "--with-sane-confdir=${placeholder "out"}/etc/sane.d"
+    "--with-udev-confdir=${placeholder "out"}/etc/udev"
+    "--with-gtkmm"
+    "--with-jpeg"
+    "--with-magick"
+    "--with-magick-pp"
+    "--with-sane"
+    "--with-tiff"
+  ];
+
+  installFlags = [ "SANE_BACKENDDIR=${placeholder "out"}/lib/sane" ];
+
+  enableParallelBuilding = true;
+
+  doInstallCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "SANE utsushi backend for some Epson scanners";
+    longDescription = ''
+      ImageScanV3 (aka utsushi) scanner driver. Non-free plugins are not
+      included, so no network support. To use the SANE backend, in
+      <literal>/etc/nixos/configuration.nix</literal>:
+
+      <literal>
+      hardware.sane = {
+        enable = true;
+        extraBackends = [ pkgs.utsushi ];
+      };
+      services.udev.packages = [ pkgs.utsushi ];
+      </literal>
+
+      Supported hardware:
+      DS-1610, DS-1630, DS-1660W, DS-310, DS-320, DS-360W, DS-40, DS-410,
+      DS-50000, DS-510, DS-520, DS-530, DS-535, DS-535H, DS-5500, DS-560,
+      DS-570W, DS-575W, DS-60000, DS-6500, DS-70, DS-70000, DS-7500, DS-760,
+      DS-770, DS-775, DS-780N, DS-80W, DS-860, EC-4020 Series, EC-4030 Series,
+      EC-4040 Series, EP-10VA Series, EP-30VA Series, EP-708A Series, EP-709A
+      Series, EP-710A Series, EP-711A Series, EP-712A Series, EP-808A Series,
+      EP-810A Series, EP-811A Series, EP-812A Series, EP-879A Series, EP-880A
+      Series, EP-881A Series, EP-882A Series, EP-978A3 Series, EP-979A3 Series,
+      EP-982A3 Series, EP-M570T Series, ES-200, ES-300W, ES-300WR, ES-400,
+      ES-50, ES-50, ES-500W, ES-500WR, ES-55R, ES-60W, ES-60WB, ES-60WW,
+      ES-65WR, ET-16500 Series, ET-2500 Series, ET-2550 Series, ET-2600 Series,
+      ET-2610 Series, ET-2650 Series, ET-2700 Series, ET-2710 Series, ET-2720
+      Series, ET-2750 Series, ET-2760 Series, ET-3600 Series, ET-3700 Series,
+      ET-3710 Series, ET-3750 Series, ET-3760 Series, ET-4500 Series, ET-4550
+      Series, ET-4700 Series, ET-4750 Series, ET-4760 Series, ET-7700 Series,
+      ET-7750 Series, ET-8700 Series, ET-M2140 Series, ET-M2170 Series,
+      ET-M3140 Series, ET-M3170 Series, ET-M3180 Series, EW-052A Series,
+      EW-452A Series, EW-M5071FT Series, EW-M571T Series, EW-M630T Series,
+      EW-M660FT Series, EW-M670FT Series, EW-M770T Series, EW-M970A3T Series,
+      FF-640, FF-680W, GT-S650, L1455 Series, L220 Series, L222 Series, L3050
+      Series, L3060 Series, L3070 Series, L3100 Series, L3110 Series, L3150
+      Series, L3160 Series, L360 Series, L362 Series, L364 Series, L365 Series,
+      L366 Series, L375 Series, L380 Series, L382 Series, L385 Series, L386
+      Series, L395 Series, L396 Series, L405 Series, L4150 Series, L4160
+      Series, L455 Series, L475 Series, L485 Series, L486 Series, L495 Series,
+      L5190 Series, L565 Series, L566 Series, L575 Series, L605 Series, L6160
+      Series, L6170 Series, L6190 Series, L655 Series, L7160 Series, L7180
+      Series, LX-10000F, LX-10000FK, LX-10010MF, LX-7000F, M2140 Series, M2170
+      Series, M3140 Series, M3170 Series, M3180 Series, PX-048A Series, PX-049A
+      Series, PX-M160T Series, PX-M270FT Series, PX-M270T Series, PX-M380F,
+      PX-M381FL, PX-M5080F Series, PX-M5081F Series, PX-M680F Series, PX-M7050
+      Series, PX-M7050FP, PX-M7050FX, PX-M7070FX, PX-M7110F, PX-M7110FP,
+      PX-M780F Series, PX-M781F Series, PX-M840FX, PX-M860F, PX-M880FX,
+      PX-M884F, PX-M885F, PX-M886FL, Perfection V19, Perfection V39, ST-2000
+      Series, ST-3000 Series, ST-4000 Series, ST-M3000 Series, WF-2750 Series,
+      WF-2760 Series, WF-2810 Series, WF-2830 Series, WF-2850 Series, WF-2860
+      Series, WF-3720 Series, WF-3730 Series, WF-4720 Series, WF-4730 Series,
+      WF-4740 Series, WF-6530 Series, WF-6590 Series, WF-7710 Series, WF-7720
+      Series, WF-8510 Series, WF-8590 Series, WF-C17590 Series, WF-C20590
+      Series, WF-C5710 Series, WF-C5790 Series, WF-C5790BA, WF-C579R Series,
+      WF-C579RB, WF-C8610 Series, WF-C8690 Series, WF-C8690B, WF-C869R Series,
+      WF-M20590 Series, WF-M5799 Series, WF-R8590 Series, XP-2100 Series,
+      XP-220 Series, XP-230 Series, XP-235 Series, XP-240 Series, XP-243 245
+      247 Series, XP-255 257 Series, XP-3100 Series, XP-332 335 Series, XP-340
+      Series, XP-342 343 345 Series, XP-352 355 Series, XP-4100 Series, XP-430
+      Series, XP-432 435 Series, XP-440 Series, XP-442 445 Series, XP-452 455
+      Series, XP-5100 Series, XP-530 Series, XP-540 Series, XP-6000 Series,
+      XP-6100 Series, XP-630 Series, XP-640 Series, XP-7100 Series, XP-830
+      Series, XP-8500 Series, XP-8600 Series, XP-900 Series, XP-960 Series,
+      XP-970 Series
+    '';
+    homepage = "https://gitlab.com/utsushi/imagescan";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ wucke13 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix b/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix
new file mode 100644
index 000000000000..e2f2bcc2f24b
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/xboxdrv/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, scons, libX11, pkgconfig
+, libusb1, boost, glib, dbus-glib }:
+
+let
+  version = "0.8.8";
+in stdenv.mkDerivation {
+  pname = "xboxdrv";
+  inherit 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 = [ ];
+    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"
+  '';
+}