Thank you so much for taking the time to respond.
So actually, the mystery deepens :
I figured that if I wanted the driver to work at least with CUPS, I would have to use the CUPS wrapper (whose the source is included in the spoiler at the end of this post) but when building I do not get the same files (cf log down) as when I do with the same URL ! I am baffled at that and trying to make sense of that now… Of course I am doing something dumb but I do not see what.
Log from the build
building '/nix/store/42wnj5ly9capmw46c75m9x1w0gqppipg-dcpl2520dwcupswrapper-3.2.0-1.drv'...
unpacking sources
./
./usr/
./usr/share/
./usr/share/doc/
./opt/
./opt/brother/
./opt/brother/Printers/
./opt/brother/Printers/BrGenML1/
./opt/brother/Printers/BrGenML1/cupswrapper/
./opt/brother/Printers/BrGenML1/cupswrapper/brother-BrGenML1-cups-en.ppd
./opt/brother/Printers/BrGenML1/cupswrapper/brother_lpdwrapper_BrGenML1
./opt/brother/Printers/BrGenML1/cupswrapper/paperconfigml1
patching sources
substitute(): ERROR: file 'opt/brother/Printers/DCPL2520DW/cupswrapper/brother_lpdwrapper_DCPL2520DW' does not exist
Log from the manual extracting
./usr/
./usr/share/
./usr/share/doc/
./etc/
./etc/opt/
./etc/opt/brother/
./etc/opt/brother/Printers/
./etc/opt/brother/Printers/DCPL2520DW/
./etc/opt/brother/Printers/DCPL2520DW/inf/
./opt/
./opt/brother/
./opt/brother/Printers/
./opt/brother/Printers/DCPL2520DW/
./opt/brother/Printers/DCPL2520DW/inf/
./opt/brother/Printers/DCPL2520DW/inf/brDCPL2520DWfunc
./opt/brother/Printers/DCPL2520DW/inf/brDCPL2520DWrc
./opt/brother/Printers/DCPL2520DW/inf/braddprinter
./opt/brother/Printers/DCPL2520DW/inf/setupPrintcap
./opt/brother/Printers/DCPL2520DW/lpd/
./opt/brother/Printers/DCPL2520DW/lpd/brprintconflsr3
./opt/brother/Printers/DCPL2520DW/lpd/filter_DCPL2520DW
./opt/brother/Printers/DCPL2520DW/lpd/rawtobr3
./var/
./var/spool/
./var/spool/lpd/
./var/spool/lpd/DCPL2520DW/
CUPS wrapper derivation source
{ stdenv, fetchurl, makeWrapper, cups, perl, coreutils, gnused, gnugrep
, dcpl2520dwlpr, debugLvl ? "0"}:
stdenv.mkDerivation rec {
name = "dcpl2520dwcupswrapper-3.2.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf101760/${name}.i386.deb";
sha256 = "0kd2a2waqr10kfv1s8is3nd5dlphw4d1343srdsbrlbbndja3s6r";
};
unpackPhase = ''
ar x $src
tar xfvz data.tar.gz
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ cups perl coreutils gnused gnugrep dcpl2520dwlpr ];
dontBuild = true;
patchPhase = ''
WRAPPER=opt/brother/Printers/DCPL2520DW/cupswrapper/brother_lpdwrapper_DCPL2520DW
PAPER_CFG=opt/brother/Printers/DCPL2520DW/cupswrapper/paperconfigml1
substituteInPlace $WRAPPER \
--replace "basedir =~" "basedir = \"${dcpl2520dwlpr}/opt/brother/Printers/DCPL2520DW\"; #" \
--replace "PRINTER =~" "PRINTER = \"DCPL2520DW\"; #" \
--replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
# Fixing issue #1 and #2.
substituteInPlace $WRAPPER \
--replace "\`cp " "\`cp -p " \
--replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
--replace "\`mv " "\`cp -p "
# This config script make this assumption that the *.ppd are found in a global location `/etc/cups/ppd`.
substituteInPlace $PAPER_CFG \
--replace "/etc/cups/ppd" "$out/share/cups/model"
'';
installPhase = ''
CUPSFILTER_DIR=$out/lib/cups/filter
CUPSPPD_DIR=$out/share/cups/model
CUPSWRAPPER_DIR=opt/brother/Printers/DCPL2520DW/cupswrapper
mkdir -p $out/$CUPSWRAPPER_DIR
cp -rp $CUPSWRAPPER_DIR/* $out/$CUPSWRAPPER_DIR
mkdir -p $CUPSFILTER_DIR
# Fixing issue #4.
makeWrapper \
$out/$CUPSWRAPPER_DIR/brother_lpdwrapper_DCPL2520DW \
$CUPSFILTER_DIR/brother_lpdwrapper_DCPL2520DW \
--prefix PATH : ${coreutils}/bin \
--prefix PATH : ${gnused}/bin \
--prefix PATH : ${gnugrep}/bin
mkdir -p $CUPSPPD_DIR
ln -s $out/$CUPSWRAPPER_DIR/brother-DCPL2520DW-cups-en.ppd $CUPSPPD_DIR
'';
dontPatchELF = true;
dontStrip = true;
}