Let's give it a try
This commit is contained in:
parent
0210accc5d
commit
46e5f2ec85
2 changed files with 67 additions and 28 deletions
|
|
@ -188,7 +188,7 @@ in
|
||||||
urwid
|
urwid
|
||||||
]))
|
]))
|
||||||
|
|
||||||
# (pkgs.callPackage ./mfcl2690dw/default.nix { })
|
(pkgs.callPackage ./mfcl2690dw/default.nix { })
|
||||||
];
|
];
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,83 @@
|
||||||
{ pkgsi686Linux, lib, stdenv, fetchurl, dpkg, makeWrapper, coreutils, ghostscript, gnugrep, gnused, which, perl }:
|
{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, perl, gnused, ghostscript, file, coreutils, gnugrep, which }:
|
||||||
|
|
||||||
|
let
|
||||||
|
arches = [ "x86_64" "i686" "armv7l" ];
|
||||||
|
|
||||||
|
runtimeDeps = [
|
||||||
|
ghostscript
|
||||||
|
file
|
||||||
|
gnused
|
||||||
|
gnugrep
|
||||||
|
coreutils
|
||||||
|
which
|
||||||
|
];
|
||||||
|
|
||||||
|
printerName = "mfcl2690dw";
|
||||||
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "mfcl2690dwpdrv";
|
pname = "cups-brother-${printerName}";
|
||||||
version = "4.0.0-1";
|
version = "4.0.0-1";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
|
||||||
|
buildInputs = [ perl ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://download.brother.com/welcome/dlf101727/${pname}-${version}.i386.deb";
|
url = "https://download.brother.com/welcome/dlf105065/${printerName}pdrv-${version}.i386.deb";
|
||||||
sha256 = "765da49f1f0d68ed36ba553e6e60aa5030e87845b74afe0d7d46ebab28ab5256";
|
sha256 = "765da49f1f0d68ed36ba553e6e60aa5030e87845b74afe0d7d46ebab28ab5256";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ dpkg makeWrapper ];
|
|
||||||
|
|
||||||
unpackPhase = "dpkg-deb -x $src $out";
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
dir=$out/opt/brother/Printers/MFCL2690DW
|
runHook preInstall
|
||||||
|
|
||||||
substituteInPlace $dir/lpd/lpdfilter \
|
mkdir -p $out
|
||||||
--replace /usr/bin/perl ${perl}/bin/perl \
|
dpkg-deb -x $src $out
|
||||||
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
|
|
||||||
|
# delete unnecessary files for the current architecture
|
||||||
|
'' + lib.concatMapStrings (arch: ''
|
||||||
|
echo Deleting files for ${arch}
|
||||||
|
rm -r "$out/opt/brother/Printers/MFCL2690DW/lpd/${arch}"
|
||||||
|
'') (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches) + ''
|
||||||
|
|
||||||
|
# bundled scripts don't understand the arch subdirectories for some reason
|
||||||
|
ln -s \
|
||||||
|
"$out/opt/brother/Printers/MFCL2690DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
|
||||||
|
"$out/opt/brother/Printers/MFCL2690DW/lpd/"
|
||||||
|
|
||||||
|
# Fix global references and replace auto discovery mechanism with hardcoded values
|
||||||
|
substituteInPlace $out/opt/brother/Printers/MFCL2690DW/lpd/lpdfilter \
|
||||||
|
--replace /opt "$out/opt" \
|
||||||
|
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL2690DW\"; #" \
|
||||||
--replace "PRINTER =~" "PRINTER = \"MFCL2690DW\"; #"
|
--replace "PRINTER =~" "PRINTER = \"MFCL2690DW\"; #"
|
||||||
|
|
||||||
wrapProgram $dir/lpd/filter_MFCL2690DW \
|
# Make sure all executables have the necessary runtime dependencies available
|
||||||
--prefix PATH : ${lib.makeBinPath [
|
find "$out" -executable -and -type f | while read file; do
|
||||||
coreutils ghostscript gnugrep gnused which
|
wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
|
||||||
]}
|
done
|
||||||
|
|
||||||
# need to use i686 glibc here, these are 32bit proprietary binaries
|
# Symlink filter and ppd into a location where CUPS will discover it
|
||||||
interpreter=${pkgsi686Linux.glibc}/lib/ld-linux.so.2
|
mkdir -p $out/lib/cups/filter
|
||||||
patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
|
mkdir -p $out/share/cups/model
|
||||||
patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
|
|
||||||
patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
|
ln -s \
|
||||||
|
$out/opt/brother/Printers/MFCL2690DW/lpd/lpdfilter \
|
||||||
|
$out/lib/cups/filter/brother_lpdwrapper_MFCL2690DW
|
||||||
|
|
||||||
|
ln -s \
|
||||||
|
$out/opt/brother/Printers/MFCL2690DW/cupswrapper/brother-MFCL2690DW-cups-en.ppd \
|
||||||
|
$out/share/cups/model/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with lib; {
|
||||||
description = "Brother MFC-L2690DW lpr driver";
|
|
||||||
homepage = "http://www.brother.com/";
|
homepage = "http://www.brother.com/";
|
||||||
|
description = "Brother MFC-L2690DW printer driver";
|
||||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||||
license = lib.licenses.unfree;
|
license = licenses.unfree;
|
||||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
platforms = builtins.map (arch: "${arch}-linux") arches;
|
||||||
maintainers = [ lib.maintainers.Enzime ];
|
maintainers = [ maintainers.lovesegfault ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue