diff --git a/pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix b/pkgs/misc/cups/drivers/mfc9140cdncupswrapper/default.nix new file mode 100644 index 000000000000..0542b2ab303e --- /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 ]; + }; +} diff --git a/pkgs/misc/cups/drivers/mfc9140cdnlpr/default.nix b/pkgs/misc/cups/drivers/mfc9140cdnlpr/default.nix new file mode 100644 index 000000000000..4128123d6431 --- /dev/null +++ b/pkgs/misc/cups/drivers/mfc9140cdnlpr/default.nix @@ -0,0 +1,73 @@ +{ stdenv +, lib +, fetchurl +, dpkg +, makeWrapper +, coreutils +, file +, gawk +, ghostscript +, gnused +, pkgsi686Linux +}: + +stdenv.mkDerivation rec { + pname = "mfc9140cdnlpr"; + version = "1.1.2-1"; + + src = fetchurl { + url = "https://download.brother.com/welcome/dlf100405/${pname}-${version}.i386.deb"; + sha256 = "1wqx8njrv078fc3vlq90qyrfg3cw9kr9m6f3qvfnkhq1f95fbslh"; + }; + + unpackPhase = '' + dpkg-deb -x $src $out + ''; + + nativeBuildInputs = [ + dpkg + makeWrapper + ]; + + dontBuild = true; + + installPhase = '' + dir=$out/opt/brother/Printers/mfc9140cdn + + patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $dir/lpd/brmfc9140cdnfilter + + wrapProgram $dir/inf/setupPrintcapij \ + --prefix PATH : ${lib.makeBinPath [ + coreutils + ]} + + substituteInPlace $dir/lpd/filtermfc9140cdn \ + --replace "BR_CFG_PATH=" "BR_CFG_PATH=\"$dir/\" #" \ + --replace "BR_LPD_PATH=" "BR_LPD_PATH=\"$dir/\" #" + + wrapProgram $dir/lpd/filtermfc9140cdn \ + --prefix PATH : ${lib.makeBinPath [ + coreutils + file + ghostscript + gnused + ]} + + substituteInPlace $dir/lpd/psconvertij2 \ + --replace '`which gs`' "${ghostscript}/bin/gs" + + wrapProgram $dir/lpd/psconvertij2 \ + --prefix PATH : ${lib.makeBinPath [ + gnused + gawk + ]} + ''; + + meta = with lib; { + description = "Brother MFC-9140CDN LPR printer driver"; + homepage = "http://www.brother.com/"; + license = licenses.unfree; + maintainers = with maintainers; [ hexa ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 51cbb4ac1fa9..39cebd00e277 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31149,6 +31149,9 @@ in mfcl8690cdwcupswrapper = callPackage ../misc/cups/drivers/mfcl8690cdwcupswrapper { }; mfcl8690cdwlpr = callPackage ../misc/cups/drivers/mfcl8690cdwlpr { }; + mfc9140cdncupswrapper = callPackage ../misc/cups/drivers/mfc9140cdncupswrapper { }; + mfc9140cdnlpr = callPackage ../misc/cups/drivers/mfc9140cdnlpr { }; + samsung-unified-linux-driver_1_00_36 = callPackage ../misc/cups/drivers/samsung/1.00.36/default.nix { }; samsung-unified-linux-driver_1_00_37 = callPackage ../misc/cups/drivers/samsung/1.00.37.nix { }; samsung-unified-linux-driver_4_00_39 = callPackage ../misc/cups/drivers/samsung/4.00.39 { };