Created
February 3, 2026 12:10
-
-
Save Munksgaard/8be38cb8e366e08bc62cf4f7489a68a0 to your computer and use it in GitHub Desktop.
Nix driver package for Brother DCPL2627DW printer
This file contains hidden or 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, | |
| dpkg, | |
| makeWrapper, | |
| coreutils, | |
| ghostscript, | |
| gnugrep, | |
| gnused, | |
| which, | |
| perl, | |
| lib, | |
| }: | |
| let | |
| model = "dcpl2627dw"; | |
| modelDir = "DCPL2627DW"; | |
| version = "4.1.0-1"; | |
| src = fetchurl { | |
| url = "https://download.brother.com/welcome/dlf106016/${model}pdrv-${version}.i386.deb"; | |
| sha256 = "e4089b34827b55f1428428aa1867a73785e67f57d6a61c653480f58676a9d85d"; | |
| }; | |
| reldir = "opt/brother/Printers/${modelDir}/"; | |
| in | |
| rec { | |
| driver = stdenv.mkDerivation rec { | |
| inherit src version; | |
| name = "${model}drv-${version}"; | |
| nativeBuildInputs = [ | |
| dpkg | |
| makeWrapper | |
| ]; | |
| unpackPhase = "dpkg-deb -x $src $out"; | |
| installPhase = '' | |
| dir="$out/${reldir}" | |
| substituteInPlace $dir/lpd/lpdfilter \ | |
| --replace /usr/bin/perl ${perl}/bin/perl \ | |
| --replace "basedir =~" "basedir = \"$dir\"; #" \ | |
| --replace "PRINTER =~" "PRINTER = \"${modelDir}\"; #" \ | |
| --replace "my \$GHOST_SCRIPT=\`which gs\`;" "my \$GHOST_SCRIPT=\"${ghostscript}/bin/gs\";" | |
| wrapProgram $dir/lpd/lpdfilter \ | |
| --prefix PATH : ${ | |
| lib.makeBinPath [ | |
| coreutils | |
| ghostscript | |
| gnugrep | |
| gnused | |
| which | |
| ] | |
| } | |
| patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |
| $dir/lpd/${stdenv.hostPlatform.linuxArch}/brprintconflsr3 | |
| patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |
| $dir/lpd/${stdenv.hostPlatform.linuxArch}/rawtobr3 | |
| ''; | |
| meta = { | |
| description = "Brother ${modelDir} driver"; | |
| homepage = "http://www.brother.com/"; | |
| sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; | |
| license = lib.licenses.unfree; | |
| platforms = [ | |
| "x86_64-linux" | |
| "i686-linux" | |
| ]; | |
| maintainers = [ ]; | |
| }; | |
| }; | |
| cupswrapper = stdenv.mkDerivation rec { | |
| inherit version src; | |
| name = "${model}cupswrapper-${version}"; | |
| nativeBuildInputs = [ | |
| dpkg | |
| makeWrapper | |
| ]; | |
| unpackPhase = "dpkg-deb -x $src $out"; | |
| installPhase = '' | |
| basedir=${driver}/${reldir} | |
| dir=$out/${reldir} | |
| substituteInPlace $dir/cupswrapper/lpdwrapper \ | |
| --replace /usr/bin/perl ${perl}/bin/perl \ | |
| --replace "basedir =~" "basedir = \"$basedir\"; #" \ | |
| --replace "PRINTER =~" "PRINTER = \"${modelDir}\"; #" | |
| wrapProgram $dir/cupswrapper/lpdwrapper \ | |
| --prefix PATH : ${ | |
| lib.makeBinPath [ | |
| coreutils | |
| gnugrep | |
| gnused | |
| ] | |
| } | |
| mkdir -p $out/lib/cups/filter | |
| mkdir -p $out/share/cups/model | |
| ln $dir/cupswrapper/lpdwrapper $out/lib/cups/filter/brother_lpdwrapper_${modelDir} | |
| ln $dir/cupswrapper/brother-${modelDir}-cups-en.ppd $out/share/cups/model | |
| ''; | |
| meta = { | |
| description = "Brother ${modelDir} CUPS wrapper driver"; | |
| homepage = "http://www.brother.com/"; | |
| sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; | |
| license = lib.licenses.gpl2Plus; | |
| platforms = [ | |
| "x86_64-linux" | |
| "i686-linux" | |
| ]; | |
| maintainers = [ ]; | |
| }; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment