push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
{
lib,
stdenv,
fetchurl,
cups,
perl,
ghostscript,
which,
makeWrapper,
}:
/*
[Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
URI example
~ `lpd://BRW0080927AFBCE/binary_p1`
Logging
-------
`/tmp/br_lpdfilter_ml1.log` when `$ENV{LPD_DEBUG} > 0` in `filter_BrGenML1`
which is activated automatically when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`
from the cups wrapper.
Issues
------
- filter_BrGenML1 ln 196 `my $GHOST_SCRIPT=`which gs`;`
`GHOST_SCRIPT` is empty resulting in an empty `/tmp/br_lpdfilter_ml1_gsout.dat` file.
See `/tmp/br_lpdfilter_ml1.log` for the executed command.
Notes
-----
- The `setupPrintcap` has totally no use in our context.
*/
let
myPatchElf = file: ''
patchelf --set-interpreter \
${stdenv.cc.libc}/lib/ld-linux${lib.optionalString stdenv.hostPlatform.is64bit "-x86-64"}.so.2 \
${file}
'';
in
stdenv.mkDerivation rec {
pname = "brgenml1lpr";
version = "3.1.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf101123/brgenml1lpr-${version}.i386.deb";
sha256 = "0zdvjnrjrz9sba0k525linxp55lr4cyivfhqbkq1c11br2nvy09f";
};
unpackPhase = ''
ar x $src
tar xfvz data.tar.gz
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
perl
stdenv.cc.libc
ghostscript
which
];
dontBuild = true;
patchPhase = ''
INFDIR=opt/brother/Printers/BrGenML1/inf
LPDDIR=opt/brother/Printers/BrGenML1/lpd
# Setup max debug log by default.
substituteInPlace $LPDDIR/filter_BrGenML1 \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/BrGenML1\"; #" \
--replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #"
${myPatchElf "$INFDIR/braddprinter"}
${myPatchElf "$LPDDIR/brprintconflsr3"}
${myPatchElf "$LPDDIR/rawtobr3"}
'';
installPhase = ''
INFDIR=opt/brother/Printers/BrGenML1/inf
LPDDIR=opt/brother/Printers/BrGenML1/lpd
mkdir -p $out/$INFDIR
cp -rp $INFDIR/* $out/$INFDIR
mkdir -p $out/$LPDDIR
cp -rp $LPDDIR/* $out/$LPDDIR
wrapProgram $out/$LPDDIR/filter_BrGenML1 \
--prefix PATH ":" "${ghostscript}/bin" \
--prefix PATH ":" "${which}/bin"
'';
dontPatchELF = true;
meta = {
description = "Brother BrGenML1 LPR driver";
homepage = "http://www.brother.com";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = lib.platforms.linux;
license = lib.licenses.unfreeRedistributable;
maintainers = with lib.maintainers; [ jraygauthier ];
};
}

View File

@@ -0,0 +1,127 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gnugrep,
which,
gawk,
}:
let
version = "1.1.3";
model = "dcp375cw";
in
{
driver = stdenv.mkDerivation {
pname = "${model}-lpr";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf005427/dcp375cwlpr-${version}-1.i386.deb";
sha256 = "6daf0144b5802ea8da394ca14db0e6f0200d4049545649283791f899b7f7bd26";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
--replace /opt "$out/opt"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/${model}/lpd/br${model}filter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brlpdwrapper${model}
wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
--prefix PATH ":" ${
lib.makeBinPath [
gawk
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
maintainers = with maintainers; [ marcovergueira ];
};
};
cupswrapper = stdenv.mkDerivation {
pname = "${model}-cupswrapper";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf005429/dcp375cwcupswrapper-${version}-1.i386.deb";
sha256 = "9a255728b595d2667b2caf9d0d332b677e1a6829a3ec1ed6d4e900a44069cf2d";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
wrapProgram $f --prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer CUPS wrapper driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
maintainers = with maintainers; [ marcovergueira ];
};
};
}

View File

@@ -0,0 +1,127 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gnugrep,
which,
gawk,
}:
let
version = "1.1.2";
model = "dcp9020cdw";
in
{
driver = stdenv.mkDerivation {
pname = "${model}-lpr";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf100441/dcp9020cdwlpr-${version}-1.i386.deb";
sha256 = "1z6nma489s0a0b0a8wyg38yxanz4k99dg29fyjs4jlprsvmwk56y";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
--replace /opt "$out/opt"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/${model}/lpd/br${model}filter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brother_lpdwrapper_${model}
wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
--prefix PATH ":" ${
lib.makeBinPath [
gawk
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_eu&os=128";
maintainers = with maintainers; [ pshirshov ];
};
};
cupswrapper = stdenv.mkDerivation {
pname = "${model}-cupswrapper";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf100443/dcp9020cdwcupswrapper-${version}-1.i386.deb";
sha256 = "04yqm1qv9p4hgp1p6mqq4siygl4056s6flv6kqln8mvmcr8zaq1s";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
wrapProgram $f --prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer CUPS wrapper driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_eu&os=128";
maintainers = with maintainers; [ pshirshov ];
};
};
}

View File

@@ -0,0 +1,116 @@
{
pkgsi686Linux,
stdenv,
fetchurl,
dpkg,
makeWrapper,
coreutils,
ghostscript,
gnugrep,
gnused,
which,
perl,
lib,
}:
let
model = "mfcl3770cdw";
version = "1.0.2-0";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103935/${model}pdrv-${version}.i386.deb";
sha256 = "09fhbzhpjymhkwxqyxzv24b06ybmajr6872yp7pri39595mhrvay";
};
reldir = "opt/brother/Printers/${model}/";
in
rec {
driver = pkgsi686Linux.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/filter_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/lpd/filter_${model} \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
which
]
}
# need to use i686 glibc here, these are 32bit proprietary binaries
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
$dir/lpd/brmfcl3770cdwfilter
'';
meta = {
description = "Brother ${lib.strings.toUpper model} driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = [
"x86_64-linux"
"i686-linux"
];
maintainers = [ lib.maintainers.steveej ];
};
};
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/brother_lpdwrapper_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "basedir =~" "basedir = \"$basedir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/cupswrapper/brother_lpdwrapper_${model} \
--prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
gnused
]
}
mkdir -p $out/lib/cups/filter
mkdir -p $out/share/cups/model
ln $dir/cupswrapper/brother_lpdwrapper_${model} $out/lib/cups/filter
ln $dir/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model
'';
meta = {
description = "Brother ${lib.strings.toUpper model} CUPS wrapper driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.gpl2Plus;
platforms = [
"x86_64-linux"
"i686-linux"
];
maintainers = [ lib.maintainers.steveej ];
};
};
}

View File

@@ -0,0 +1,145 @@
{
stdenv,
lib,
fetchzip,
autoconf,
automake,
libtool,
cups,
popt,
libtiff,
libpng,
ghostscript,
}:
/*
this derivation is basically just a transcription of the rpm .spec
file included in the tarball
*/
stdenv.mkDerivation {
pname = "cnijfilter";
/*
important note about versions: cnijfilter packages seem to use
versions in a non-standard way. the version indicates which
printers are supported in the package. so this package should
not be "upgraded" in the usual way.
instead, if you want to include another version supporting your
printer, you should try to abstract out the common things (which
should be pretty much everything except the version and the 'pr'
and 'pr_id' values to loop over).
*/
version = "2.80";
src = fetchzip {
url = "http://gdlp01.c-wss.com/gds/1/0100000841/01/cnijfilter-common-2.80-1.tar.gz";
sha256 = "06s9nl155yxmx56056y22kz1p5b2sb5fhr3gf4ddlczjkd1xch53";
};
nativeBuildInputs = [
autoconf
automake
];
buildInputs = [
libtool
cups
popt
libtiff
libpng
ghostscript
];
env.NIX_CFLAGS_COMPILE = " -std=gnu90";
patches = [
./patches/missing-include.patch
./patches/libpng15.patch
];
postPatch = ''
sed -i "s|/usr/lib/cups/backend|$out/lib/cups/backend|" backend/src/Makefile.am;
sed -i "s|/usr|$out|" backend/src/cnij_backend_common.c;
sed -i "s|/usr/bin|${ghostscript}/bin|" pstocanonij/filter/pstocanonij.c;
sed -i "s|/usr/local|$out|" libs/bjexec/bjexec.c;
'';
configurePhase = ''
cd libs
./autogen.sh --prefix=$out;
cd ../cngpij
./autogen.sh --prefix=$out --enable-progpath=$out/bin;
cd ../pstocanonij
./autogen.sh --prefix=$out --enable-progpath=$out/bin;
cd ../backend
./autogen.sh --prefix=$out;
cd ..;
'';
preInstall = ''
mkdir -p $out/bin $out/lib/cups/filter $out/share/cups/model;
'';
postInstall = ''
for pr in mp140 mp210 ip3500 mp520 ip4500 mp610; do
cd ppd;
./autogen.sh --prefix=$out --program-suffix=$pr
make clean;
make;
make install;
cd ../cnijfilter;
./autogen.sh --prefix=$out --program-suffix=$pr --enable-libpath=/var/lib/cups/path/lib/bjlib --enable-binpath=$out/bin;
make clean;
make;
make install;
cd ..;
done;
mkdir -p $out/lib/bjlib;
for pr_id in 315 316 319 328 326 327; do
install -c -m 755 $pr_id/database/* $out/lib/bjlib;
install -c -s -m 755 $pr_id/libs_bin/*.so.* $out/lib;
done;
pushd $out/lib;
for so_file in *.so.*; do
ln -s $so_file ''${so_file/.so.*/}.so;
patchelf --set-rpath $out/lib $so_file;
done;
popd;
'';
/*
the tarball includes some pre-built shared libraries. we run
'patchelf --set-rpath' on them just a few lines above, so that
they can find each other. but that's not quite enough. some of
those libraries load each other in non-standard ways -- they
don't list each other in the DT_NEEDED section. so, if the
standard 'patchelf --shrink-rpath' (from
pkgs/development/tools/misc/patchelf/setup-hook.sh) is run on
them, it undoes the --set-rpath. this prevents that.
*/
dontPatchELF = true;
# fortify hardening makes the filter crash
# https://github.com/NixOS/nixpkgs/issues/276125
hardeningDisable = [ "fortify3" ];
meta = with lib; {
description = "Canon InkJet printer drivers for the iP5400, MP520, MP210, MP140, iP3500, and MP610 series. (MP520 drivers also work for MX700.)";
homepage = "http://support-asia.canon-asia.com/content/EN/0100084101.html";
sourceProvenance = with sourceTypes; [
fromSource
binaryNativeCode
];
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ jerith666 ];
};
}

View File

@@ -0,0 +1,23 @@
diff -aur cnijfilter-source-3.20-1/cnijfilter/src/bjfimage.c cnijfilter-source-3.20-1.new/cnijfilter/src/bjfimage.c
--- cnijfilter-source-3.20-1/cnijfilter/src/bjfimage.c 2009-03-26 06:11:05.000000000 +0100
+++ cnijfilter-source-3.20-1.new/cnijfilter/src/bjfimage.c 2012-02-10 09:33:52.512334139 +0100
@@ -1520,8 +1520,8 @@
short tmpformat;
short retbyte = 0;
short bpp = 3;
- long width = 0;
- long length = 0;
+ png_uint_32 width = 0;
+ png_uint_32 length = 0;
long rstep = 0;
long RasterLength = 0;
long i;
@@ -1574,7 +1574,7 @@
goto onErr;
}
- if (setjmp (png_p->jmpbuf))
+ if (setjmp (png_jmpbuf(png_p)))
{
png_destroy_read_struct(&png_p, &info_p, (png_infopp)NULL);
goto onErr;

View File

@@ -0,0 +1,20 @@
--- a/backend/src/cnij_backend_common.c 2008-09-01 10:05:44.000000000 +0200
+++ b/backend/src/cnij_backend_common.c 2012-05-06 17:38:40.000000000 +0200
@@ -39,6 +39,7 @@
// CUPS Header
#include <cups/cups.h>
#include <cups/ipp.h>
+#include <cups/ppd.h>
// Header file for CANON
#include "cnij_backend_common.h"
--- a/cngpijmon/src/bjcupsmon_cups.c 2008-09-02 12:28:24.000000000 +0200
+++ b/cngpijmon/src/bjcupsmon_cups.c 2012-05-06 17:39:20.000000000 +0200
@@ -21,6 +21,7 @@
/*** Includes ***/
#include <cups/cups.h>
#include <cups/language.h>
+#include <cups/ppd.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>

View File

@@ -0,0 +1,117 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "3.0.1-1";
cupsdeb = fetchurl {
url = "http://download.brother.com/welcome/dlf100421/hl1110cupswrapper-${version}.i386.deb";
sha256 = "a87880f4ece764a724411b5b24d15d1b912f6ffc6ecbfd9fac4cd5eda13d2eb7";
};
srcdir = "hl1110cupswrapper-GPL_src-${version}";
cupssrc = fetchurl {
url = "http://download.brother.com/welcome/dlf100422/${srcdir}.tar.gz";
sha256 = "be1dce6a4608cb253b0b382db30bf5885da46b010e8eb595b15c435e2487761c";
};
lprdeb = fetchurl {
url = "http://download.brother.com/welcome/dlf100419/hl1110lpr-${version}.i386.deb";
sha256 = "5af241782a0d500d7f47e06ea43d61127f4019b5b1c6e68b4c1cb4521a742c22";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl1110";
inherit version;
srcs = [
lprdeb
cupssrc
cupsdeb
];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
unpackPhase = ''
tar -xvf ${cupssrc}
'';
buildPhase = ''
gcc -Wall ${srcdir}/brcupsconfig/brcupsconfig.c -o brcupsconfig4
'';
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1110/lpd/filter_HL1110 \
--replace /opt "$out/opt" \
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/HL1110/lpd/psconvert2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/lpd/brprintconflsr3
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/lpd/rawtobr3
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/inf/braddprinter
wrapProgram $out/opt/brother/Printers/HL1110/lpd/psconvert2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/HL1110/lpd/filter_HL1110 \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 --replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 $out/lib/cups/filter/brother_lpdwrapper_HL1110
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brother-HL1110-cups-en.ppd $out/lib/cups/filter/brother-HL1110-cups-en.ppd
cp brcupsconfig4 $out/opt/brother/Printers/HL1110/cupswrapper/
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brcupsconfig4 $out/lib/cups/filter/brcupsconfig4
wrapProgram $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother HL1110 printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=hl1110_us_eu_as&os=128#SelectLanguageType-561_0_1";
};
}

View File

@@ -0,0 +1,106 @@
{
lib,
stdenv,
pkgsi686Linux,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "3.0.1-1";
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101546/hl1210wcupswrapper-${version}.i386.deb";
sha256 = "0395mnw6c7qpjgjch9in5q9p2fjdqvz9bwfwp6q1hzhs08ryk7w0";
};
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101547/hl1210wlpr-${version}.i386.deb";
sha256 = "1sl3g2cd4a2gygryrr27ax3qaa65cbirz3kzskd8afkwqpmjyv7j";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl1210W";
inherit version;
srcs = [
lprdeb
cupsdeb
];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1210W/lpd/filter_HL1210W \
--replace /opt "$out/opt"
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/HL1210W/lpd/psconvert2
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/lpd/brprintconflsr3
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/lpd/rawtobr3
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/inf/braddprinter
wrapProgram $out/opt/brother/Printers/HL1210W/lpd/psconvert2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/HL1210W/lpd/filter_HL1210W \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
# install cups
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W --replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter $out/share/cups/model
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W $out/lib/cups/filter/brother_lpdwrapper_HL1210W
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brother-HL1210W-cups-en.ppd $out/share/cups/model/
# cp brcupsconfig4 $out/opt/brother/Printers/HL1110/cupswrapper/
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brcupsconfig4 $out/lib/cups/filter/brcupsconfig4
wrapProgram $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother HL1210W printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=nz&lang=en&prod=hl1210w_eu_as&os=128";
};
}

View File

@@ -0,0 +1,122 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
coreutils,
perl,
gnugrep,
which,
debugLvl ? "0",
}:
let
version = "3.2.0-1";
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf102692/hl2260dlpr-${version}.i386.deb";
hash = "sha256-R+cM2SKc/MP6keo3PUrKXPC6a2dEQQdBunrpNtAHlH0=";
};
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf102693/hl2260dcupswrapper-${version}.i386.deb";
hash = "sha256-k6+ulZVoFTpEY6WJ9TO9Rzp2c4dwPqL3NY5/XYJpvOc=";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl2260d";
inherit version;
nativeBuildInputs = [
makeWrapper
dpkg
];
buildInputs = [
cups
ghostscript
perl
];
dontPatchELF = true;
dontBuild = true;
unpackPhase = ''
mkdir -p $out
dpkg-deb -x ${cupsdeb} $out
dpkg-deb -x ${lprdeb} $out
'';
patchPhase = ''
# Patch lpr
INFDIR=$out/opt/brother/Printers/HL2260D/inf
LPDDIR=$out/opt/brother/Printers/HL2260D/lpd
substituteInPlace $LPDDIR/filter_HL2260D \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HL2260D\"; #" \
--replace "PRINTER =~" "PRINTER = \"HL2260D\"; #"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$INFDIR/braddprinter
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$LPDDIR/brprintconflsr3
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$LPDDIR/rawtobr3
# Patch cupswrapper
WRAPPER=$out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D
PAPER_CFG=$out/opt/brother/Printers/HL2260D/cupswrapper/paperconfigml1
substituteInPlace $WRAPPER \
--replace "basedir =~" "basedir = \"$out/opt/brother/Printers/HL2260D\"; #" \
--replace "PRINTER =~" "PRINTER = \"HL2260D\"; #" \
--replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
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 = ''
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/HL2260D/cupswrapper/brother-HL2260D-cups-en.ppd $out/share/cups/model
mkdir -p $out/lib/cups/filter/
makeWrapper \
$out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D \
$out/lib/cups/filter/brother_lpdwrapper_HL2260D \
--prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
gnused
]
}
wrapProgram $out/opt/brother/Printers/HL2260D/lpd/filter_HL2260D \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother HL-2260D printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [
"x86_64-linux"
"i686-linux"
];
downloadPage = "https://support.brother.com/g/b/downloadtop.aspx?c=cn_ot&lang=en&prod=hl2260d_cn";
maintainers = with maintainers; [ u2x1 ];
};
}

View File

@@ -0,0 +1,120 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "1.1.4-0";
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf007070/hl3140cwcupswrapper-${version}.i386.deb";
sha256 = "a76281828ca6ee86c63034673577fadcf5f24e8ed003213bdbb6bf47a7aced6f";
};
srcdir = "hl3140cw_cupswrapper_GPL_source_${version}";
cupssrc = fetchurl {
url = "https://download.brother.com/welcome/dlf006740/${srcdir}.tar.gz";
sha256 = "1wp85rbvbar6rqqkaffymxjpls6jx9m9230dlrpqwy5akiaxf0rl";
};
lprdeb = fetchurl {
url = "https://support.brother.com/g/b/files/dlf/dlf007068/hl3140cwlpr-1.1.2-1.i386.deb";
sha256 = "601f392b52ed7080f71b780181823bb8f6abfd0591146b452ba1f23e21f9f865";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl3140cw";
inherit version;
nativeBuildInputs = [
makeWrapper
dpkg
];
buildInputs = [
cups
ghostscript
a2ps
];
unpackPhase = ''
tar -xvf ${cupssrc}
'';
buildPhase = ''
gcc -Wall ${srcdir}/brcupsconfig/brcupsconfig.c -o brcupsconfpt1
'';
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
--replace /opt "$out/opt"
substituteInPlace $out/opt/brother/Printers/hl3140cw/inf/setupPrintcapij \
--replace /opt "$out/opt"
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/hl3140cw/lpd/brhl3140cwfilter
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/usr/bin/brprintconf_hl3140cw
wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
--replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw $out/lib/cups/filter/cupswrapperhl3140cw
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brother_hl3140cw_printer_en.ppd $out/lib/cups/filter/brother_hl3140cw_printer_en.ppd
cp brcupsconfpt1 $out/opt/brother/Printers/hl3140cw/cupswrapper/
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brcupsconfpt1 $out/lib/cups/filter/brcupsconfpt1
ln -s $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw $out/lib/cups/filter/brother_lpdwrapper_hl3140cw
wrapProgram $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother hl3140cw printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=hl3140cw_us_eu&os=128";
};
}

View File

@@ -0,0 +1,105 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
perl,
gnugrep,
which,
}:
let
version = "3.2.0-1";
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101912/hll2340dlpr-${version}.i386.deb";
sha256 = "c0ae98b49b462cd8fbef445550f2177ce9d8bf627c904e182daa8cbaf8781e50";
};
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101913/hll2340dcupswrapper-${version}.i386.deb";
sha256 = "8aa24a6a825e3a4d5b51778cb46fe63032ec5a731ace22f9ef2b0ffcc2033cc9";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hll2340dw";
inherit version;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
mkdir -p $out
dpkg-deb -x ${cupsdeb} $out
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D \
--replace /opt "$out/opt" \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2340D/\"; #" \
--replace "PRINTER =~" "PRINTER = \"HLL2340D\"; #"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/HLL2340D/lpd/brprintconflsr3
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/HLL2340D/lpd/rawtobr3
for f in \
$out/opt/brother/Printers/HLL2340D/cupswrapper/brother_lpdwrapper_HLL2340D \
$out/opt/brother/Printers/HLL2340D/cupswrapper/paperconfigml1 \
; do
wrapProgram $f \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D $out/lib/cups/filter/brother_lpdwrapper_HLL2340D
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/HLL2340D/cupswrapper/brother-HLL2340D-cups-en.ppd $out/share/cups/model/
wrapProgram $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother hl-l2340dw printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=us&lang=es&prod=hll2340dw_us_eu_as&os=128&flang=English";
maintainers = [ maintainers.qknight ];
};
}

View File

@@ -0,0 +1,97 @@
{
stdenv,
lib,
fetchurl,
perl,
gnused,
dpkg,
makeWrapper,
autoPatchelfHook,
libredirect,
}:
stdenv.mkDerivation rec {
pname = "cups-brother-hll3230cdw";
version = "1.0.2";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103925/hll3230cdwpdrv-${version}-0.i386.deb";
sha256 = "9d49abc584bf22bc381510618a34107ead6ab14562b51831fefd6009947aa5a9";
};
nativeBuildInputs = [
dpkg
makeWrapper
autoPatchelfHook
];
buildInputs = [
perl
gnused
libredirect
];
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -pr opt "$out"
cp -pr usr/bin "$out/bin"
rm "$out/opt/brother/Printers/hll3230cdw/cupswrapper/cupswrapperhll3230cdw"
mkdir -p "$out/lib/cups/filter" "$out/share/cups/model"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw" \
"$out/lib/cups/filter/brother_lpdwrapper_hll3230cdw"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_hll3230cdw_printer_en.ppd" \
"$out/share/cups/model/brother_hll3230cdw_printer_en.ppd"
runHook postInstall
'';
# Fix global references and replace auto discovery mechanism
# with hardcoded values.
#
# The configuration binary 'brprintconf_hll3230cdw' and lpd filter
# 'brhll3230cdwfilter' has hardcoded /opt format strings. There isn't
# sufficient space in the binaries to substitute a path in the store, so use
# libredirect to get it to see the correct path. The configuration binary
# also uses this format string to print configuration locations. Here the
# wrapper output is processed to point into the correct location in the
# store.
postFixup = ''
substituteInPlace $out/opt/brother/Printers/hll3230cdw/lpd/filter_hll3230cdw \
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/hll3230cdw/\"; #" \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #"
substituteInPlace $out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #" \
--replace "my \$basedir = \`readlink \$0\`" "my \$basedir = \"$out/opt/brother/Printers/hll3230cdw/\""
wrapProgram $out/bin/brprintconf_hll3230cdw \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
wrapProgram $out/opt/brother/Printers/hll3230cdw/lpd/brhll3230cdwfilter \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
substituteInPlace $out/bin/brprintconf_hll3230cdw \
--replace \"\$"@"\" \"\$"@\" | LD_PRELOAD= ${gnused}/bin/sed -E '/^(function list :|resource file :).*/{s#/opt#$out/opt#}'"
'';
meta = with lib; {
description = "Brother HL-L3230CDW printer driver";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ aplund ];
platforms = [
"x86_64-linux"
"i686-linux"
];
homepage = "http://www.brother.com/";
downloadPage = "https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll3230cdw_us_eu_as&os=128&dlid=dlf103925_000&flang=4&type3=10283";
};
}

View File

@@ -0,0 +1,78 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
ghostscript,
a2ps,
coreutils,
gnused,
gawk,
file,
makeWrapper,
}:
stdenv.mkDerivation rec {
pname = "mfcj470dw-cupswrapper";
version = "3.0.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf006843/mfcj470dwlpr-${version}.i386.deb";
sha256 = "7202dd895d38d50bb767080f2995ed350eed99bc2b7871452c3c915c8eefc30a";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
dpkg-deb -x $src $out
substituteInPlace $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw \
--replace /opt "$out/opt" \
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/lpd/brmfcj470dwfilter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw $out/lib/cups/filter/brother_lpdwrapper_mfcj470dw
wrapProgram $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother MFC-J470DW LPR driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128";
maintainers = [ lib.maintainers.yochai ];
};
}

View File

@@ -0,0 +1,125 @@
{
lib,
stdenv,
fetchurl,
pkgsi686Linux,
dpkg,
makeWrapper,
coreutils,
gnused,
gawk,
file,
cups,
util-linux,
xxd,
runtimeShell,
ghostscript,
a2ps,
}:
# Why:
# The executable "brprintconf_mfcj6510dw" binary is looking for "/opt/brother/Printers/%s/inf/br%sfunc" and "/opt/brother/Printers/%s/inf/br%src".
# Whereby, %s is printf(3) string substitution for stdin's arg0 (the command's own filename) from the 10th char forwards, as a runtime dependency.
# e.g. Say the filename is "0123456789ABCDE", the runtime will be looking for /opt/brother/Printers/ABCDE/inf/brABCDEfunc.
# Presumably, the binary was designed to be deployed under the filename "printconf_mfcj6510dw", whereby it will search for "/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwfunc".
# For NixOS, we want to change the string to the store path of brmfcj6510dwfunc and brmfcj6510dwrc but we're faced with two complications:
# 1. Too little room to specify the nix store path. We can't even take advantage of %s by renaming the file to the store path hash since the variable is too short and can't contain the whole hash.
# 2. The binary needs the directory it's running from to be r/w.
# What:
# As such, we strip the path and substitution altogether, leaving only "brmfcj6510dwfunc" and "brmfcj6510dwrc", while filling the leftovers with nulls.
# Fully null terminating the cstrings is necessary to keep the array the same size and preventing overflows.
# We then use a shell script to link and execute the binary, func and rc files in a temporary directory.
# How:
# In the package, we dump the raw binary as a string of search-able hex values using hexdump. We execute the substitution with sed. We then convert the hex values back to binary form using xxd.
# We also write a shell script that invoked "mktemp -d" to produce a r/w temporary directory and link what we need in the temporary directory.
# Result:
# The user can run brprintconf_mfcj6510dw in the shell.
stdenv.mkDerivation rec {
pname = "mfcj6510dwlpr";
version = "3.0.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf006614/mfcj6510dwlpr-${version}.i386.deb";
sha256 = "1ccvx393pqavsgzd8igrzlin5jrsf01d3acyvwqd1d0yz5jgqy6d";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
brprintconf_mfcj6510dw_script = ''
#!${runtimeShell}
cd $(mktemp -d)
ln -s @out@/usr/bin/brprintconf_mfcj6510dw_patched brprintconf_mfcj6510dw_patched
ln -s @out@/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwfunc brmfcj6510dwfunc
ln -s @out@/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwrc brmfcj6510dwrc
./brprintconf_mfcj6510dw_patched "$@"
'';
installPhase = ''
dpkg-deb -x $src $out
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw \
--replace /opt "$out/opt"
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/lpd/psconvertij2 \
--replace "GHOST_SCRIPT=`which gs`" "GHOST_SCRIPT=${ghostscript}/bin/gs"
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/inf/setupPrintcapij \
--replace "/opt/brother/Printers" "$out/opt/brother/Printers" \
--replace "printcap.local" "printcap"
patchelf --set-interpreter ${pkgsi686Linux.stdenv.cc.libc.out}/lib/ld-linux.so.2 \
--set-rpath $out/opt/brother/Printers/mfcj6510dw/inf:$out/opt/brother/Printers/mfcj6510dw/lpd \
$out/opt/brother/Printers/mfcj6510dw/lpd/brmfcj6510dwfilter
patchelf --set-interpreter ${pkgsi686Linux.stdenv.cc.libc.out}/lib/ld-linux.so.2 $out/usr/bin/brprintconf_mfcj6510dw
#stripping the hardcoded path.
${util-linux}/bin/hexdump -ve '1/1 "%.2X"' $out/usr/bin/brprintconf_mfcj6510dw | \
sed 's.2F6F70742F62726F746865722F5072696E746572732F25732F696E662F6272257366756E63.62726d66636a36353130647766756e63000000000000000000000000000000000000000000.' | \
sed 's.2F6F70742F62726F746865722F5072696E746572732F25732F696E662F627225737263.62726D66636A3635313064777263000000000000000000000000000000000000000000.' | \
${xxd}/bin/xxd -r -p > $out/usr/bin/brprintconf_mfcj6510dw_patched
chmod +x $out/usr/bin/brprintconf_mfcj6510dw_patched
#executing from current dir. segfaults if it's not r\w.
mkdir -p $out/bin
echo -n "$brprintconf_mfcj6510dw_script" > $out/bin/brprintconf_mfcj6510dw
chmod +x $out/bin/brprintconf_mfcj6510dw
substituteInPlace $out/bin/brprintconf_mfcj6510dw --replace @out@ $out
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw $out/lib/cups/filter/brother_lpdwrapper_mfcj6510dw
wrapProgram $out/opt/brother/Printers/mfcj6510dw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
coreutils
gnused
gawk
]
}
wrapProgram $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw \
--prefix PATH ":" ${
lib.makeBinPath [
coreutils
gnused
file
ghostscript
a2ps
]
}
'';
meta = with lib; {
description = "Brother MFC-J6510DW LPR driver";
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj6510dw_all&os=128";
homepage = "http://www.brother.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = with licenses; unfree;
maintainers = with maintainers; [ ramkromberg ];
platforms = with platforms; linux;
};
}

View File

@@ -0,0 +1,66 @@
{
lib,
stdenv,
coreutils,
dpkg,
fetchurl,
ghostscript,
gnugrep,
gnused,
makeWrapper,
perl,
which,
}:
stdenv.mkDerivation rec {
pname = "mfcl2700dnlpr";
version = "3.2.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf102085/${pname}-${version}.i386.deb";
sha256 = "170qdzxlqikzvv2wphvfb37m19mn13az4aj88md87ka3rl5knk4m";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
dontUnpack = true;
installPhase = ''
dpkg-deb -x $src $out
dir=$out/opt/brother/Printers/MFCL2700DN
substituteInPlace $dir/lpd/filter_MFCL2700DN \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"MFCL2700DN\"; #"
wrapProgram $dir/lpd/filter_MFCL2700DN \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
which
]
}
interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
'';
meta = {
description = "Brother MFC-L2700DN LPR driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.tv ];
platforms = [ "i686-linux" ];
};
}

View File

@@ -0,0 +1,108 @@
{
lib,
stdenv,
fetchurl,
cups,
libusb-compat-0_1,
libxml2,
}:
let
arch = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
in
stdenv.mkDerivation (finalAttrs: {
pname = "samsung-unified-linux-driver";
version = "1.00.37";
src = fetchurl {
sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb";
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${finalAttrs.version}.tar.gz";
};
buildInputs = [
cups
libusb-compat-0_1
libxml2
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -R ${arch}/{gettext,pstosecps,rastertospl,smfpnetdiscovery,usbresetter} $out/bin
mkdir -p $out/etc/sane.d/dll.d/
install -m644 noarch/etc/smfp.conf $out/etc/sane.d
echo smfp >> $out/etc/sane.d/dll.d/smfp-scanner.conf
mkdir -p $out/lib
install -m755 ${arch}/libscmssc.so* $out/lib
mkdir -p $out/lib/cups/backend
ln -s $out/bin/smfpnetdiscovery $out/lib/cups/backend
mkdir -p $out/lib/cups/filter
ln -s $out/bin/{pstosecps,rastertospl} $out/lib/cups/filter
ln -s $ghostscript/bin/gs $out/lib/cups/filter
mkdir -p $out/lib/sane
install -m755 ${arch}/libsane-smfp.so* $out/lib/sane
ln -s libsane-smfp.so.1.0.1 $out/lib/sane/libsane-smfp.so.1
ln -s libsane-smfp.so.1 $out/lib/sane/libsane-smfp.so
mkdir -p $out/lib/udev/rules.d
(
OEM_FILE=noarch/oem.conf
INSTALL_LOG_FILE=/dev/null
. noarch/scripting_utils
. noarch/package_utils
. noarch/scanner-script.pkg
fill_full_template noarch/etc/smfp.rules.in $out/lib/udev/rules.d/60_smfp_samsung.rules
chmod -x $out/lib/udev/rules.d/60_smfp_samsung.rules
)
mkdir -p $out/share
cp -R noarch/share/* $out/share
gzip -9 $out/share/ppd/*.ppd
rm -r $out/share/locale/*/*/install.mo
mkdir -p $out/share/cups
cd $out/share/cups
ln -s ../ppd .
ln -s ppd model
runHook postInstall
'';
preFixup = ''
for bin in "$out/bin/"*; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$bin"
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$bin"
done
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$out/lib/libscmssc.so"
patchelf --set-rpath "$out/lib:${libxml2.out}/lib:${libusb-compat-0_1.out}/lib" "$out/lib/sane/libsane-smfp.so.1.0.1"
ln -s ${lib.getLib stdenv.cc.cc}/lib/libstdc++.so.6 $out/lib/
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
meta = {
description = "Unified Linux Driver for Samsung printers and scanners";
homepage = "http://www.bchemnet.com/suldr";
downloadPage = "http://www.bchemnet.com/suldr/driver/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
# Tested on linux-x86_64. Might work on linux-i386.
# Probably won't work on anything else.
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,103 @@
# Tested on linux-x86_64. Might work on linux-i386. Probably won't work on anything else.
# To use this driver in NixOS, add it to printing.drivers in configuration.nix.
# configuration.nix might look like this when you're done:
# { pkgs, ... }: {
# printing = {
# enable = true;
# drivers = [ pkgs.samsung-unified-linux-driver_4_01_17 ];
# };
# (more stuff)
# }
# (This advice was tested on the 1st November 2016.)
{
lib,
stdenv,
cups,
libusb-compat-0_1,
fetchurl,
patchPpdFilesHook,
}:
# Do not bump lightly! Visit <http://www.bchemnet.com/suldr/supported.html>
# to see what will break when upgrading. Consider a new versioned attribute.
let
installationPath = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
appendPath = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
libPath =
lib.makeLibraryPath [
cups
libusb-compat-0_1
]
+ ":$out/lib:${lib.getLib stdenv.cc.cc}/lib";
in
stdenv.mkDerivation (finalAttrs: {
pname = "samsung-unified-linux-driver";
version = "4.01.17";
src = fetchurl {
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${finalAttrs.version}.tar.gz";
sha256 = "1vv3pzvqpg1dq3xjr8161x2yp3v7ca75vil56ranhw5pkjwq66x0";
};
nativeBuildInputs = [ patchPpdFilesHook ];
dontPatchELF = true;
dontStrip = true;
installPhase = ''
runHook preInstall
cd Linux/${installationPath}
mkdir -p $out/lib/cups/{backend,filter}
install -Dm755 mfp $out/lib/cups/backend/
install -Dm755 pstosecps pstospl pstosplc rastertospl rastertosplc $out/lib/cups/filter/
install -Dm755 libscmssc.so $out/lib/
GLOBIGNORE=*.so
for exe in $out/lib/cups/**/*; do
echo "Patching $exe"
patchelf \
--set-rpath ${libPath} \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$exe
done
unset GLOBIGNORE
install -v at_root/usr/lib${appendPath}/libmfp.so.1.0.1 $out/lib
cd $out/lib
ln -s -f libmfp.so.1.0.1 libmfp.so.1
ln -s -f libmfp.so.1 libmfp.so
for lib in $out/lib/*.so; do
echo "Patching $lib"
patchelf \
--set-rpath ${libPath} \
$lib
done
mkdir -p $out/share/cups/model/samsung
cd -
cd ../noarch/at_opt/share/ppd
cp -r ./* $out/share/cups/model/samsung
runHook postInstall
'';
ppdFileCommands = [
"pstosecps"
"pstospl"
"pstosplc"
"rastertospl"
];
meta = {
description = "Samsung's Linux printing drivers; includes binaries without source code";
homepage = "http://www.samsung.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ joko ];
};
})