1{
2 lib,
3 stdenv,
4 fetchurl,
5 cups,
6 dpkg,
7 gnused,
8 makeWrapper,
9 ghostscript,
10 file,
11 a2ps,
12 coreutils,
13 gnugrep,
14 which,
15 gawk,
16}:
17
18let
19 version = "1.1.3";
20 model = "dcp375cw";
21in
22rec {
23 driver = stdenv.mkDerivation {
24 pname = "${model}-lpr";
25 inherit version;
26
27 src = fetchurl {
28 url = "https://download.brother.com/welcome/dlf005427/dcp375cwlpr-${version}-1.i386.deb";
29 sha256 = "6daf0144b5802ea8da394ca14db0e6f0200d4049545649283791f899b7f7bd26";
30 };
31
32 nativeBuildInputs = [
33 dpkg
34 makeWrapper
35 ];
36 buildInputs = [
37 cups
38 ghostscript
39 a2ps
40 gawk
41 ];
42 unpackPhase = "dpkg-deb -x $src $out";
43
44 installPhase = ''
45 substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
46 --replace /opt "$out/opt"
47
48 patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
49 $out/opt/brother/Printers/${model}/lpd/br${model}filter
50
51 mkdir -p $out/lib/cups/filter/
52 ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brlpdwrapper${model}
53
54 wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
55 --prefix PATH ":" ${
56 lib.makeBinPath [
57 gawk
58 ghostscript
59 a2ps
60 file
61 gnused
62 gnugrep
63 coreutils
64 which
65 ]
66 }
67 '';
68
69 meta = with lib; {
70 homepage = "http://www.brother.com/";
71 description = "Brother ${model} printer driver";
72 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
73 license = licenses.unfree;
74 platforms = platforms.linux;
75 downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
76 maintainers = with maintainers; [ marcovergueira ];
77 };
78 };
79
80 cupswrapper = stdenv.mkDerivation {
81 pname = "${model}-cupswrapper";
82 inherit version;
83
84 src = fetchurl {
85 url = "https://download.brother.com/welcome/dlf005429/dcp375cwcupswrapper-${version}-1.i386.deb";
86 sha256 = "9a255728b595d2667b2caf9d0d332b677e1a6829a3ec1ed6d4e900a44069cf2d";
87 };
88
89 nativeBuildInputs = [
90 dpkg
91 makeWrapper
92 ];
93 buildInputs = [
94 cups
95 ghostscript
96 a2ps
97 gawk
98 ];
99 unpackPhase = "dpkg-deb -x $src $out";
100
101 installPhase = ''
102 for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
103 wrapProgram $f --prefix PATH : ${
104 lib.makeBinPath [
105 coreutils
106 ghostscript
107 gnugrep
108 gnused
109 ]
110 }
111 done
112
113 mkdir -p $out/share/cups/model
114 ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
115 '';
116
117 meta = with lib; {
118 homepage = "http://www.brother.com/";
119 description = "Brother ${model} printer CUPS wrapper driver";
120 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
121 license = licenses.unfree;
122 platforms = platforms.linux;
123 downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
124 maintainers = with maintainers; [ marcovergueira ];
125 };
126 };
127}