feat: add justyna-p300, dcpj4110dw driver, nixos-anywhere compatibility
This commit is contained in:
parent
0611e8179b
commit
e8b2876885
14 changed files with 610 additions and 33 deletions
109
nix/pkgs/dcpj4110dw/default.nix
Normal file
109
nix/pkgs/dcpj4110dw/default.nix
Normal file
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
pkgsi686Linux,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
dpkg,
|
||||
makeWrapper,
|
||||
coreutils,
|
||||
ghostscript,
|
||||
gnugrep,
|
||||
gnused,
|
||||
which,
|
||||
lib,
|
||||
cups,
|
||||
a2ps,
|
||||
gawk,
|
||||
file,
|
||||
proot,
|
||||
bash,
|
||||
}: let
|
||||
model = "dcpj4110dw";
|
||||
version = "3.0.1-1";
|
||||
src = fetchurl {
|
||||
url = "https://download.brother.com/welcome/dlf005595/${model}lpr-${version}.i386.deb";
|
||||
sha256 = "sha256-ryKDsSkabAD2X3WLmeqjdB3+4DXdJ0qUz3O64DV+ixw=";
|
||||
};
|
||||
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 = ''
|
||||
# need to use i686 glibc here, these are 32bit proprietary binaries
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
$out/${reldir}/lpd/br${model}filter
|
||||
|
||||
mkdir -p $out/lib/cups/filter/
|
||||
ln -s $out/${reldir}/lpd/filter${model} $out/lib/cups/filter/brother_lpdwrapper_${model}
|
||||
|
||||
# use proot to bind /opt for the filter
|
||||
mv $out/${reldir}/lpd/filter${model} $out/${reldir}/lpd/.wrapped_filter${model}
|
||||
|
||||
cat <<-EOF >$out/${reldir}/lpd/.wrapper_inner_filter${model}
|
||||
export PATH=\$PATH:${lib.makeBinPath [gawk file a2ps coreutils ghostscript gnugrep gnused which]}
|
||||
exec $out/${reldir}/lpd/.wrapped_filter${model}
|
||||
EOF
|
||||
chmod +x $out/${reldir}/lpd/.wrapper_inner_filter${model}
|
||||
|
||||
cat <<-EOF >$out/${reldir}/lpd/filter${model}
|
||||
#!${bash}/bin/bash
|
||||
exec ${proot}/bin/proot \
|
||||
-b /nix/store:/nix/store \
|
||||
-b $out/opt:/opt \
|
||||
-b ${cups}/share:/usr/share/cups \
|
||||
$out/${reldir}/lpd/.wrapper_inner_filter${model}
|
||||
EOF
|
||||
chmod +x $out/${reldir}/lpd/filter${model}
|
||||
'';
|
||||
|
||||
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 = fetchurl {
|
||||
url = "https://download.brother.com/welcome/dlf005597/${model}cupswrapper-${version}.i386.deb";
|
||||
sha256 = "sha256-nwpuuXqBrEh5tye14gFLrezktTz6kq7HtnGqdBbgGkk=";
|
||||
};
|
||||
|
||||
name = "${model}cupswrapper-${version}";
|
||||
|
||||
nativeBuildInputs = [dpkg makeWrapper];
|
||||
buildInputs = [cups ghostscript a2ps gawk];
|
||||
|
||||
unpackPhase = "dpkg-deb -x $src $out";
|
||||
|
||||
installPhase = ''
|
||||
wrapProgram $out/${reldir}/cupswrapper/cupswrapper${model} \
|
||||
--prefix PATH : ${lib.makeBinPath [coreutils ghostscript gnugrep gnused]}
|
||||
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
$out/${reldir}/cupswrapper/brcupsconfpt1
|
||||
|
||||
mkdir -p $out/share/cups/model
|
||||
ln -s $out/${reldir}/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.gpl2;
|
||||
platforms = ["x86_64-linux" "i686-linux"];
|
||||
maintainers = [lib.maintainers.steveej];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue