13 stdenv.mkDerivation rec {
14 pname = "cups-brother-hll3230cdw";
17 url = "https://download.brother.com/welcome/dlf103925/hll3230cdwpdrv-${version}-0.i386.deb";
18 sha256 = "9d49abc584bf22bc381510618a34107ead6ab14562b51831fefd6009947aa5a9";
33 unpackPhase = "dpkg-deb -x $src .";
40 cp -pr usr/bin "$out/bin"
41 rm "$out/opt/brother/Printers/hll3230cdw/cupswrapper/cupswrapperhll3230cdw"
43 mkdir -p "$out/lib/cups/filter" "$out/share/cups/model"
45 ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw" \
46 "$out/lib/cups/filter/brother_lpdwrapper_hll3230cdw"
47 ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_hll3230cdw_printer_en.ppd" \
48 "$out/share/cups/model/brother_hll3230cdw_printer_en.ppd"
53 # Fix global references and replace auto discovery mechanism
54 # with hardcoded values.
56 # The configuration binary 'brprintconf_hll3230cdw' and lpd filter
57 # 'brhll3230cdwfilter' has hardcoded /opt format strings. There isn't
58 # sufficient space in the binaries to substitute a path in the store, so use
59 # libredirect to get it to see the correct path. The configuration binary
60 # also uses this format string to print configuration locations. Here the
61 # wrapper output is processed to point into the correct location in the
65 substituteInPlace $out/opt/brother/Printers/hll3230cdw/lpd/filter_hll3230cdw \
66 --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/hll3230cdw/\"; #" \
67 --replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #"
69 substituteInPlace $out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw \
70 --replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #" \
71 --replace "my \$basedir = \`readlink \$0\`" "my \$basedir = \"$out/opt/brother/Printers/hll3230cdw/\""
73 wrapProgram $out/bin/brprintconf_hll3230cdw \
74 --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
75 --set NIX_REDIRECTS /opt=$out/opt
77 wrapProgram $out/opt/brother/Printers/hll3230cdw/lpd/brhll3230cdwfilter \
78 --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
79 --set NIX_REDIRECTS /opt=$out/opt
81 substituteInPlace $out/bin/brprintconf_hll3230cdw \
82 --replace \"\$"@"\" \"\$"@\" | LD_PRELOAD= ${gnused}/bin/sed -E '/^(function list :|resource file :).*/{s#/opt#$out/opt#}'"
86 description = "Brother HL-L3230CDW printer driver";
87 license = licenses.unfree;
88 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
89 maintainers = with maintainers; [ aplund ];
94 homepage = "http://www.brother.com/";
95 downloadPage = "https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll3230cdw_us_eu_as&os=128&dlid=dlf103925_000&flang=4&type3=10283";