17 arches = [ "x86_64" "i686" "armv7l" ];
29 stdenv.mkDerivation rec {
30 pname = "cups-brother-hll2350dw";
33 nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
34 buildInputs = [ perl ];
39 url = "https://download.brother.com/welcome/dlf103566/hll2350dwpdrv-${version}.i386.deb";
40 sha256 = "0b7hhln105agc3rwpi7cjlx5nf4d2yk9iksahdv3725nnd06lg46";
49 # delete unnecessary files for the current architecture
50 '' + lib.concatMapStrings (arch: ''
51 echo Deleting files for ${arch}
52 rm -r "$out/opt/brother/Printers/HLL2350DW/lpd/${arch}"
53 '') (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches) + ''
55 # bundled scripts don't understand the arch subdirectories for some reason
57 "$out/opt/brother/Printers/HLL2350DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
58 "$out/opt/brother/Printers/HLL2350DW/lpd/"
60 # Fix global references and replace auto discovery mechanism with hardcoded values
61 substituteInPlace $out/opt/brother/Printers/HLL2350DW/lpd/lpdfilter \
62 --replace /opt "$out/opt" \
63 --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2350DW\"; #" \
64 --replace "PRINTER =~" "PRINTER = \"HLL2350DW\"; #"
66 # Make sure all executables have the necessary runtime dependencies available
67 find "$out" -executable -and -type f | while read file; do
68 wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
71 # Symlink filter and ppd into a location where CUPS will discover it
72 mkdir -p $out/lib/cups/filter
73 mkdir -p $out/share/cups/model
76 $out/opt/brother/Printers/HLL2350DW/lpd/lpdfilter \
77 $out/lib/cups/filter/brother_lpdwrapper_HLL2350DW
80 $out/opt/brother/Printers/HLL2350DW/cupswrapper/brother-HLL2350DW-cups-en.ppd \
81 $out/share/cups/model/
87 homepage = "http://www.brother.com/";
88 description = "Brother HL-L2350DW printer driver";
89 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
90 license = licenses.unfree;
91 platforms = builtins.map (arch: "${arch}-linux") arches;
92 downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=us_ot&lang=en&prod=hll2350dw_us_eu_as&os=128";
93 maintainers = [ maintainers.sternenseemann ];