17 arches = [ "x86_64" "i686" "armv7l" ];
29 stdenv.mkDerivation rec {
30 pname = "cups-brother-mfcl2750dw";
33 nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
34 buildInputs = [ perl ];
39 url = "https://download.brother.com/welcome/dlf103530/mfcl2750dwpdrv-${version}.i386.deb";
40 hash = "sha256-3uDwzLQTF8r1tsGZ7ChGhk4ryQmVsZYdUaj9eFaC0jc=";
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/MFCL2750DW/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/MFCL2750DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
58 "$out/opt/brother/Printers/MFCL2750DW/lpd/"
60 # Fix global references and replace auto discovery mechanism with hardcoded values
61 substituteInPlace $out/opt/brother/Printers/MFCL2750DW/lpd/lpdfilter \
62 --replace /opt "$out/opt" \
63 --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL2750DW\"; #" \
64 --replace "PRINTER =~" "PRINTER = \"MFCL2750DW\"; #"
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/MFCL2750DW/lpd/lpdfilter \
77 $out/lib/cups/filter/brother_lpdwrapper_MFCL2750DW
80 $out/opt/brother/Printers/MFCL2750DW/cupswrapper/brother-MFCL2750DW-cups-en.ppd \
81 $out/share/cups/model/
87 homepage = "http://www.brother.com/";
88 description = "Brother MFC-L2750DW printer driver";
89 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
90 license = licenses.unfree;
91 platforms = builtins.map (arch: "${arch}-linux") arches;
92 maintainers = [ maintainers.lovesegfault ];