Created
August 21, 2017 09:21
-
-
Save NWuensche/785a107dbc0dfff1496fa9d97df4680f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, fetchurl, cups, dpkg, ghostscript, patchelf, a2ps, coreutils, gnused, gawk, file, makeWrapper }: | |
stdenv.mkDerivation rec { | |
name = "mfcj47dd0dw-cupswrapper-${version}"; | |
version = "3.0.0-1"; | |
src = fetchurl { | |
url = "http://download.brother.com/welcome/dlf006148/mfc5440cnlpr-1.0.2-1.i386.deb"; | |
sha256 = "ce1c2f3778e4101ddd114d5a6274a8b5a034807f54d68e1b74de42007a616db6"; | |
}; | |
srcLPD = fetchurl { | |
# url = "https://gist.githubusercontent.com/NWuensche/dd18e1079eb97448d55098e4fc39f2f4/raw/27a69f8404d9156f618ff3a3ebdebfa49f93193c/brlpdwrapperMFC5440CN"; | |
url = "file:///home/nwuensche/Downloads/brlpdwrapperMFC5440CN"; | |
sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"; | |
}; | |
srcPPD = fetchurl { | |
# url = "https://gist.githubusercontent.com/NWuensche/dd18e1079eb97448d55098e4fc39f2f4/raw/27a69f8404d9156f618ff3a3ebdebfa49f93193c/brlpdwrapperMFC5440CN"; | |
url = "file:///home/nwuensche/Downloads/MFC.ppd"; | |
sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"; | |
}; | |
nativeBuildInputs = [ makeWrapper ]; | |
buildInputs = [ cups ghostscript dpkg a2ps ]; | |
unpackPhase = "true"; | |
installPhase = '' | |
dpkg-deb -x $src $out | |
substituteInPlace $out/usr/local/Brother/lpd/filterMFC5440CN \ | |
--replace /opt "$out/opt" \ | |
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs'$out/usr/local/Brother/lpd/psconvertij2 | |
patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/usr/local/Brother/lpd/rastertobrij2 | |
mkdir -p $out/lib/cups/filter/ | |
ln -s $srcLPD $out/lib/cups/filter/brlpdwrapperMFC5440CN | |
wrapProgram $out/usr/local/Brother/lpd/psconvertij2 \ | |
--prefix PATH ":" ${ stdenv.lib.makeBinPath [ gnused coreutils gawk ] } | |
wrapProgram $out/usr/local/Brother/lpd/filterMFC5440CN \ | |
--prefix PATH ":" ${ stdenv.lib.makeBinPath [ ghostscript a2ps file gnused coreutils ] } | |
mkdir -p $out/share/cups/model | |
cp $srcPPD $out/share/cups/model/brmfc5440cn_cups.ppd | |
# mkdir -p $out/lib/cups/filter | |
#cp $srcLPD $out/lib/cups/filter/brlpdwrapperMFC5440CN | |
''; | |
postInstallPhase = '' | |
chmod 0777 $out/lib/cups/filter/brlpdwrapperMFC5440CN | |
chmod 0777 $srcLPD | |
''; | |
meta = { | |
homepage = http://www.brother.com/; | |
description = "Brother MFC-J470DW LPR driver"; | |
license = stdenv.lib.licenses.unfree; | |
platforms = stdenv.lib.platforms.linux; | |
downloadPage = http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128; | |
maintainers = [ stdenv.lib.maintainers.yochai ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment