1 { lib, stdenv, fetchurl, dpkg, makeWrapper, coreutils, gnugrep, gnused, perl, mfcl2740dwlpr }:
3 stdenv.mkDerivation rec {
4 pname = "mfcl2740dwcupswrapper";
8 url = "https://download.brother.com/welcome/dlf101726/${pname}-${version}.i386.deb";
9 sha256 = "078453e19f20ab6c7fc4d63c3e09f162f3d1410c04c23a294b6ffbd720b35ffb";
12 nativeBuildInputs = [ dpkg makeWrapper ];
14 unpackPhase = "dpkg-deb -x $src $out";
17 basedir=${mfcl2740dwlpr}/opt/brother/Printers/MFCL2740DW
18 dir=$out/opt/brother/Printers/MFCL2740DW
20 substituteInPlace $dir/cupswrapper/brother_lpdwrapper_MFCL2740DW \
21 --replace /usr/bin/perl ${perl}/bin/perl \
22 --replace "basedir =~" "basedir = \"$basedir\"; #" \
23 --replace "PRINTER =~" "PRINTER = \"MFCL2740DW\"; #"
25 substituteInPlace $dir/cupswrapper/paperconfigml1 \
26 --replace /usr/bin/perl ${perl}/bin/perl
28 wrapProgram $dir/cupswrapper/brother_lpdwrapper_MFCL2740DW \
29 --prefix PATH : ${lib.makeBinPath [ coreutils gnugrep gnused ]}
31 mkdir -p $out/lib/cups/filter
32 mkdir -p $out/share/cups/model
34 ln $dir/cupswrapper/brother_lpdwrapper_MFCL2740DW $out/lib/cups/filter
35 ln $dir/cupswrapper/brother-MFCL2740DW-cups-en.ppd $out/share/cups/model
39 description = "Brother MFC-L2740DW CUPS wrapper driver";
40 homepage = "http://www.brother.com/";
41 license = lib.licenses.gpl2Plus;
42 platforms = [ "x86_64-linux" "i686-linux" ];