git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #125890 from mweinelt/brother-mfc9140cdn
commitfd800a838ce8e3f7197bcae47903f1b88f8bfeb2 authorMartin Weinelt <mweinelt@users.noreply.github.com> dateWed 16 Jun 2021, 00:42 (5 years ago) parent40ad3ba76f168a
3 files changed+144
pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix+68 pkgs/misc/cups/drivers/mfc9140cdnlpr/default.nix+73 pkgs/top-level/all-packages.nix+3
pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nixnew file+68
@@ -0,0 +1,68 @@
1+{ lib
2+, stdenv
3+, fetchurl
4+, dpkg
5+, makeWrapper
6+, coreutils
7+, gnugrep
8+, gnused
9+, mfc9140cdnlpr
10+, pkgsi686Linux
11+, psutils
12+}:
13+
14+stdenv.mkDerivation rec {
15+ pname = "mfc9140cdncupswrapper";
16+ version = "1.1.4-0";
17+
18+ src = fetchurl {
19+ url = "https://download.brother.com/welcome/dlf100407/${pname}-${version}.i386.deb";
20+ sha256 = "18aramgqgra1shdhsa75i0090hk9i267gvabildwsk52kq2b96c6";
21+ };
22+
23+ unpackPhase = ''
24+ dpkg-deb -x $src $out
25+ '';
26+
27+ nativeBuildInputs = [
28+ dpkg
29+ makeWrapper
30+ ];
31+
32+ dontBuild = true;
33+
34+ installPhase = ''
35+ lpr=${mfc9140cdnlpr}/opt/brother/Printers/mfc9140cdn
36+ dir=$out/opt/brother/Printers/mfc9140cdn
37+
38+ interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2
39+ patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1"
40+
41+ substituteInPlace $dir/cupswrapper/cupswrappermfc9140cdn \
42+ --replace "mkdir -p /usr" ": # mkdir -p /usr" \
43+ --replace '/opt/brother/''${device_model}/''${printer_model}/lpd/filter''${printer_model}' "$lpr/lpd/filtermfc9140cdn" \
44+ --replace '/usr/share/ppd/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
45+ --replace '/usr/share/cups/model/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
46+ --replace '/opt/brother/Printers/''${printer_model}/' "$lpr/" \
47+ --replace 'nup="psnup' "nup=\"${psutils}/bin/psnup" \
48+ --replace '/usr/bin/psnup' "${psutils}/bin/psnup"
49+
50+ mkdir -p $out/lib/cups/filter
51+ mkdir -p $out/share/cups/model
52+
53+ ln $dir/cupswrapper/cupswrappermfc9140cdn $out/lib/cups/filter
54+ ln $dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd $out/share/cups/model
55+
56+ sed -n '/!ENDOFWFILTER!/,/!ENDOFWFILTER!/p' "$dir/cupswrapper/cupswrappermfc9140cdn" | sed '1 br; b; :r s/.*/printer_model=mfc9140cdn; cat <<!ENDOFWFILTER!/' | bash > $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
57+ sed -i "/#! \/bin\/sh/a PATH=${lib.makeBinPath [ coreutils gnused gnugrep ]}:\$PATH" $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
58+ chmod +x $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
59+ '';
60+
61+ meta = with lib; {
62+ description = "Brother MFC-9140CDN CUPS wrapper driver";
63+ homepage = "http://www.brother.com/";
64+ license = licenses.gpl2Plus;
65+ platforms = platforms.linux;
66+ maintainers = with maintainers; [ hexa ];
67+ };
68+}
pkgs/misc/cups/drivers/mfc9140cdnlpr/default.nixnew file+73
@@ -0,0 +1,73 @@
1+{ stdenv
2+, lib
3+, fetchurl
4+, dpkg
5+, makeWrapper
6+, coreutils
7+, file
8+, gawk
9+, ghostscript
10+, gnused
11+, pkgsi686Linux
12+}:
13+
14+stdenv.mkDerivation rec {
15+ pname = "mfc9140cdnlpr";
16+ version = "1.1.2-1";
17+
18+ src = fetchurl {
19+ url = "https://download.brother.com/welcome/dlf100405/${pname}-${version}.i386.deb";
20+ sha256 = "1wqx8njrv078fc3vlq90qyrfg3cw9kr9m6f3qvfnkhq1f95fbslh";
21+ };
22+
23+ unpackPhase = ''
24+ dpkg-deb -x $src $out
25+ '';
26+
27+ nativeBuildInputs = [
28+ dpkg
29+ makeWrapper
30+ ];
31+
32+ dontBuild = true;
33+
34+ installPhase = ''
35+ dir=$out/opt/brother/Printers/mfc9140cdn
36+
37+ patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $dir/lpd/brmfc9140cdnfilter
38+
39+ wrapProgram $dir/inf/setupPrintcapij \
40+ --prefix PATH : ${lib.makeBinPath [
41+ coreutils
42+ ]}
43+
44+ substituteInPlace $dir/lpd/filtermfc9140cdn \
45+ --replace "BR_CFG_PATH=" "BR_CFG_PATH=\"$dir/\" #" \
46+ --replace "BR_LPD_PATH=" "BR_LPD_PATH=\"$dir/\" #"
47+
48+ wrapProgram $dir/lpd/filtermfc9140cdn \
49+ --prefix PATH : ${lib.makeBinPath [
50+ coreutils
51+ file
52+ ghostscript
53+ gnused
54+ ]}
55+
56+ substituteInPlace $dir/lpd/psconvertij2 \
57+ --replace '`which gs`' "${ghostscript}/bin/gs"
58+
59+ wrapProgram $dir/lpd/psconvertij2 \
60+ --prefix PATH : ${lib.makeBinPath [
61+ gnused
62+ gawk
63+ ]}
64+ '';
65+
66+ meta = with lib; {
67+ description = "Brother MFC-9140CDN LPR printer driver";
68+ homepage = "http://www.brother.com/";
69+ license = licenses.unfree;
70+ maintainers = with maintainers; [ hexa ];
71+ platforms = [ "i686-linux" "x86_64-linux" ];
72+ };
73+}
pkgs/top-level/all-packages.nix+3
@@ -31149,6 +31149,9 @@ in
3114931149 mfcl8690cdwcupswrapper = callPackage ../misc/cups/drivers/mfcl8690cdwcupswrapper { };
3115031150 mfcl8690cdwlpr = callPackage ../misc/cups/drivers/mfcl8690cdwlpr { };
3115131151
31152+ mfc9140cdncupswrapper = callPackage ../misc/cups/drivers/mfc9140cdncupswrapper { };
31153+ mfc9140cdnlpr = callPackage ../misc/cups/drivers/mfc9140cdnlpr { };
31154+
3115231155 samsung-unified-linux-driver_1_00_36 = callPackage ../misc/cups/drivers/samsung/1.00.36/default.nix { };
3115331156 samsung-unified-linux-driver_1_00_37 = callPackage ../misc/cups/drivers/samsung/1.00.37.nix { };
3115431157 samsung-unified-linux-driver_4_00_39 = callPackage ../misc/cups/drivers/samsung/4.00.39 { };