Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgs/misc/cups/drivers: add brother mfcl3770cdw #55531

Merged
merged 1 commit into from
Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions pkgs/misc/cups/drivers/brother/mfcl3770cdw/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{ pkgsi686Linux
, stdenv
, fetchurl
, dpkg
, makeWrapper
, coreutils
, ghostscript
, gnugrep
, gnused
, which
, perl
, lib
}:

let
model = "mfcl3770cdw";
version = "1.0.2-0";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103935/${model}pdrv-${version}.i386.deb";
sha256 = "09fhbzhpjymhkwxqyxzv24b06ybmajr6872yp7pri39595mhrvay";
};
reldir = "opt/brother/Printers/${model}/";

in rec {
driver = pkgsi686Linux.stdenv.mkDerivation rec {
inherit src version;
name = "${model}drv-${version}";

nativeBuildInputs = [ dpkg makeWrapper ];

unpackPhase = "dpkg-deb -x $src $out";

installPhase = ''
dir="$out/${reldir}"
substituteInPlace $dir/lpd/filter_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/lpd/filter_${model} \
--prefix PATH : ${stdenv.lib.makeBinPath [
coreutils ghostscript gnugrep gnused which
]}
# need to use i686 glibc here, these are 32bit proprietary binaries
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
$dir/lpd/brmfcl3770cdwfilter
'';

meta = {
description = "Brother ${lib.strings.toUpper model} driver";
homepage = http://www.brother.com/;
license = stdenv.lib.licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = [ stdenv.lib.maintainers.steveej ];
};
};

cupswrapper = stdenv.mkDerivation rec {
inherit version src;
name = "${model}cupswrapper-${version}";

nativeBuildInputs = [ dpkg makeWrapper ];

unpackPhase = "dpkg-deb -x $src $out";

installPhase = ''
basedir=${driver}/${reldir}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a way to improve overridability:

inherit driver;
installPhase = ''
  basedir="$driver/${reldir}"

dir=$out/${reldir}
substituteInPlace $dir/cupswrapper/brother_lpdwrapper_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "basedir =~" "basedir = \"$basedir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/cupswrapper/brother_lpdwrapper_${model} \
--prefix PATH : ${stdenv.lib.makeBinPath [ coreutils gnugrep gnused ]}
mkdir -p $out/lib/cups/filter
mkdir -p $out/share/cups/model
ln $dir/cupswrapper/brother_lpdwrapper_${model} $out/lib/cups/filter
ln $dir/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model
'';

meta = {
description = "Brother ${lib.strings.toUpper model} CUPS wrapper driver";
homepage = http://www.brother.com/;
license = stdenv.lib.licenses.gpl2;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = [ stdenv.lib.maintainers.steveej ];
};
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25155,6 +25155,10 @@ in
mfcl2740dwcupswrapper = callPackage ../misc/cups/drivers/mfcl2740dwcupswrapper { };
mfcl2740dwlpr = callPackage ../misc/cups/drivers/mfcl2740dwlpr { };

# This driver is only available as a 32 bit proprietary binary driver
mfcl3770cdwlpr = (callPackage ../misc/cups/drivers/brother/mfcl3770cdw/default.nix { }).driver;
mfcl3770cdwcupswrapper = (callPackage ../misc/cups/drivers/brother/mfcl3770cdw/default.nix { }).cupswrapper;

mfcl8690cdwcupswrapper = callPackage ../misc/cups/drivers/mfcl8690cdwcupswrapper { };
mfcl8690cdwlpr = callPackage ../misc/cups/drivers/mfcl8690cdwlpr { };

Expand Down