17 arches = [ "x86_64" "i686" "armv7l" ];
29 stdenv.mkDerivation rec {
30 pname = "cups-brother-hll2375dw";
33 nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
34 buildInputs = [ perl ];
37 url = "https://download.brother.com/welcome/dlf103535//hll2375dwpdrv-${version}.i386.deb";
38 hash = "sha256-N5VCBZLFrfw29QjjzlSvQ12urvyaf7ez/RJ08UwqHdk=";
42 # The brother lpdwrapper uses a temporary file to convey the printer settings.
43 # The original settings file will be copied with "400" permissions and the "brprintconflsr3"
44 # binary cannot alter the temporary file later on. This fixes the permissions so the can be modified.
45 # Since this is all in briefly in the temporary directory of systemd-cups and not accessible by others,
46 # it shouldn't be a security concern.
54 # delete unnecessary files for the current architecture
55 '' + lib.concatMapStrings
57 echo Deleting files for ${arch}
58 rm -r "$out/opt/brother/Printers/HLL2375DW/lpd/${arch}"
60 (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches) + ''
61 # bundled scripts don't understand the arch subdirectories for some reason
63 "$out/opt/brother/Printers/HLL2375DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
64 "$out/opt/brother/Printers/HLL2375DW/lpd/"
66 # Fix global references and replace auto discovery mechanism with hardcoded values
67 substituteInPlace $out/opt/brother/Printers/HLL2375DW/lpd/lpdfilter \
68 --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2375DW\"; #" \
69 --replace "PRINTER =~" "PRINTER = \"HLL2375DW\"; #"
70 substituteInPlace $out/opt/brother/Printers/HLL2375DW/cupswrapper/lpdwrapper \
71 --replace "my \$basedir = C" "my \$basedir = \"$out/opt/brother/Printers/HLL2375DW\" ; #" \
72 --replace "PRINTER =~" "PRINTER = \"HLL2375DW\"; #"
74 # Make sure all executables have the necessary runtime dependencies available
75 find "$out" -executable -and -type f | while read file; do
76 wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
79 # Symlink filter and ppd into a location where CUPS will discover it
80 mkdir -p $out/lib/cups/filter
81 mkdir -p $out/share/cups/model
82 mkdir -p $out/etc/opt/brother/Printers/HLL2375DW/inf
84 ln -s $out/opt/brother/Printers/HLL2375DW/inf/brHLL2375DWrc \
85 $out/etc/opt/brother/Printers/HLL2375DW/inf/brHLL2375DWrc
87 $out/opt/brother/Printers/HLL2375DW/cupswrapper/lpdwrapper \
88 $out/lib/cups/filter/brother_lpdwrapper_HLL2375DW
90 $out/opt/brother/Printers/HLL2375DW/cupswrapper/brother-HLL2375DW-cups-en.ppd \
91 $out/share/cups/model/
96 homepage = "http://www.brother.com/";
97 description = "Brother HLL2375DW printer driver";
98 license = licenses.unfree;
99 platforms = builtins.map (arch: "${arch}-linux") arches;
100 maintainers = [ maintainers.gador ];