summary refs log tree commit diff
path: root/pkgs/misc/cups
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2021-02-01 15:27:32 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2021-06-15 03:00:49 +0200
commit76f168a4f1005c3b0afb99a511b808f56e68db54 (patch)
tree24d0dae2036c70787d104ce2df17c5b8f5bb4ce6 /pkgs/misc/cups
parentf52c8862c9b1fc524bd1401185944de6274db43b (diff)
downloadnixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar.gz
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar.bz2
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar.lz
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar.xz
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.tar.zst
nixpkgs-76f168a4f1005c3b0afb99a511b808f56e68db54.zip
mfc9140cdncupswrapper: init at 1.1.4-0
Diffstat (limited to 'pkgs/misc/cups')
-rw-r--r--pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix b/pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix
new file mode 100644
index 00000000000..0542b2ab303
--- /dev/null
+++ b/pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix
@@ -0,0 +1,68 @@
+{ lib
+, stdenv
+, fetchurl
+, dpkg
+, makeWrapper
+, coreutils
+, gnugrep
+, gnused
+, mfc9140cdnlpr
+, pkgsi686Linux
+, psutils
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mfc9140cdncupswrapper";
+  version = "1.1.4-0";
+
+  src = fetchurl {
+    url = "https://download.brother.com/welcome/dlf100407/${pname}-${version}.i386.deb";
+    sha256 = "18aramgqgra1shdhsa75i0090hk9i267gvabildwsk52kq2b96c6";
+  };
+
+  unpackPhase = ''
+    dpkg-deb -x $src $out
+  '';
+
+  nativeBuildInputs = [
+    dpkg
+    makeWrapper
+  ];
+
+  dontBuild = true;
+
+  installPhase = ''
+    lpr=${mfc9140cdnlpr}/opt/brother/Printers/mfc9140cdn
+    dir=$out/opt/brother/Printers/mfc9140cdn
+
+    interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2
+    patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1"
+
+    substituteInPlace $dir/cupswrapper/cupswrappermfc9140cdn \
+      --replace "mkdir -p /usr" ": # mkdir -p /usr" \
+      --replace '/opt/brother/''${device_model}/''${printer_model}/lpd/filter''${printer_model}' "$lpr/lpd/filtermfc9140cdn" \
+      --replace '/usr/share/ppd/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
+      --replace '/usr/share/cups/model/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
+      --replace '/opt/brother/Printers/''${printer_model}/' "$lpr/" \
+      --replace 'nup="psnup' "nup=\"${psutils}/bin/psnup" \
+      --replace '/usr/bin/psnup' "${psutils}/bin/psnup"
+
+    mkdir -p $out/lib/cups/filter
+    mkdir -p $out/share/cups/model
+
+    ln $dir/cupswrapper/cupswrappermfc9140cdn $out/lib/cups/filter
+    ln $dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd $out/share/cups/model
+
+    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
+    sed -i "/#! \/bin\/sh/a PATH=${lib.makeBinPath [ coreutils gnused gnugrep ]}:\$PATH" $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
+    chmod +x $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
+    '';
+
+  meta = with lib; {
+    description = "Brother MFC-9140CDN CUPS wrapper driver";
+    homepage = "http://www.brother.com/";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ hexa ];
+  };
+}