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=";
41 unpackPhase = "dpkg-deb -x $src .";
44 # The brother lpdwrapper uses a temporary file to convey the printer settings.
45 # The original settings file will be copied with "400" permissions and the "brprintconflsr3"
46 # binary cannot alter the temporary file later on. This fixes the permissions so the can be modified.
47 # Since this is all in briefly in the temporary directory of systemd-cups and not accessible by others,
48 # it shouldn't be a security concern.
56 # delete unnecessary files for the current architecture
57 '' + lib.concatMapStrings
59 echo Deleting files for ${arch}
60 rm -r "$out/opt/brother/Printers/HLL2375DW/lpd/${arch}"
62 (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches) + ''
63 # bundled scripts don't understand the arch subdirectories for some reason
65 "$out/opt/brother/Printers/HLL2375DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
66 "$out/opt/brother/Printers/HLL2375DW/lpd/"
68 # Fix global references and replace auto discovery mechanism with hardcoded values
69 substituteInPlace $out/opt/brother/Printers/HLL2375DW/lpd/lpdfilter \
70 --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2375DW\"; #" \
71 --replace "PRINTER =~" "PRINTER = \"HLL2375DW\"; #"
72 substituteInPlace $out/opt/brother/Printers/HLL2375DW/cupswrapper/lpdwrapper \
73 --replace "my \$basedir = C" "my \$basedir = \"$out/opt/brother/Printers/HLL2375DW\" ; #" \
74 --replace "PRINTER =~" "PRINTER = \"HLL2375DW\"; #"
76 # Make sure all executables have the necessary runtime dependencies available
77 find "$out" -executable -and -type f | while read file; do
78 wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
81 # Symlink filter and ppd into a location where CUPS will discover it
82 mkdir -p $out/lib/cups/filter
83 mkdir -p $out/share/cups/model
84 mkdir -p $out/etc/opt/brother/Printers/HLL2375DW/inf
86 ln -s $out/opt/brother/Printers/HLL2375DW/inf/brHLL2375DWrc \
87 $out/etc/opt/brother/Printers/HLL2375DW/inf/brHLL2375DWrc
89 $out/opt/brother/Printers/HLL2375DW/cupswrapper/lpdwrapper \
90 $out/lib/cups/filter/brother_lpdwrapper_HLL2375DW
92 $out/opt/brother/Printers/HLL2375DW/cupswrapper/brother-HLL2375DW-cups-en.ppd \
93 $out/share/cups/model/
98 homepage = "http://www.brother.com/";
99 description = "Brother HLL2375DW printer driver";
100 license = licenses.unfree;
101 platforms = builtins.map (arch: "${arch}-linux") arches;
102 maintainers = [ maintainers.gador ];