1{
2 lib,
3 stdenv,
4 coreutils,
5 dpkg,
6 fetchurl,
7 ghostscript,
8 gnugrep,
9 gnused,
10 makeWrapper,
11 perl,
12 which,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "mfcl2700dnlpr";
17 version = "3.2.0-1";
18
19 src = fetchurl {
20 url = "https://download.brother.com/welcome/dlf102085/${pname}-${version}.i386.deb";
21 sha256 = "170qdzxlqikzvv2wphvfb37m19mn13az4aj88md87ka3rl5knk4m";
22 };
23
24 nativeBuildInputs = [
25 dpkg
26 makeWrapper
27 ];
28
29 dontUnpack = true;
30
31 installPhase = ''
32 dpkg-deb -x $src $out
33
34 dir=$out/opt/brother/Printers/MFCL2700DN
35
36 substituteInPlace $dir/lpd/filter_MFCL2700DN \
37 --replace /usr/bin/perl ${perl}/bin/perl \
38 --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
39 --replace "PRINTER =~" "PRINTER = \"MFCL2700DN\"; #"
40
41 wrapProgram $dir/lpd/filter_MFCL2700DN \
42 --prefix PATH : ${
43 lib.makeBinPath [
44 coreutils
45 ghostscript
46 gnugrep
47 gnused
48 which
49 ]
50 }
51
52 interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
53 patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
54 patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
55 patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
56 '';
57
58 meta = {
59 description = "Brother MFC-L2700DN LPR driver";
60 homepage = "http://www.brother.com/";
61 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
62 license = lib.licenses.unfree;
63 maintainers = [ lib.maintainers.tv ];
64 platforms = [ "i686-linux" ];
65 };
66}