diff options
author | Martin Weinelt <mweinelt@users.noreply.github.com> | 2023-03-26 14:56:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 14:56:55 +0200 |
commit | ed3f363d371536d90e9aebce9782f955a6981b7d (patch) | |
tree | e7e2397a2bb1d560c3ae409b950fb91817b90bfe /pkgs/misc | |
parent | 52038a5e50c2646c3cd8ba0a04c0d87010653dd8 (diff) | |
parent | 38ac9d077aabe8967c7119a6844abd3f24524f2a (diff) |
Merge pull request #221924 from MartinRamm/brother-mfc5890cn
mfc5890cn{lpr,cupswrapper}: init
Diffstat (limited to 'pkgs/misc')
-rw-r--r-- | pkgs/misc/cups/drivers/mfc5890cncupswrapper/default.nix | 76 | ||||
-rw-r--r-- | pkgs/misc/cups/drivers/mfc5890cnlpr/default.nix | 75 |
2 files changed, 151 insertions, 0 deletions
diff --git a/pkgs/misc/cups/drivers/mfc5890cncupswrapper/default.nix b/pkgs/misc/cups/drivers/mfc5890cncupswrapper/default.nix new file mode 100644 index 0000000000000..8521430833348 --- /dev/null +++ b/pkgs/misc/cups/drivers/mfc5890cncupswrapper/default.nix @@ -0,0 +1,76 @@ +{ lib +, findutils +, stdenv +, fetchurl +, dpkg +, makeWrapper +, coreutils +, gnugrep +, gnused +, mfc5890cnlpr +, pkgsi686Linux +, psutils +}: + +stdenv.mkDerivation rec { + pname = "mfc5890cncupswrapper"; + version = "1.1.2-2"; + + src = fetchurl { + url = "https://download.brother.com/welcome/dlf006170/${pname}-${version}.i386.deb"; + hash = "sha256-UOCwzB09/a1/2rliY+hTrslSvO5ztVj51auisPx7OIQ="; + }; + + unpackPhase = '' + dpkg-deb -x $src $out + ''; + + nativeBuildInputs = [ + dpkg + makeWrapper + ]; + + dontBuild = true; + + installPhase = '' + lpr=${mfc5890cnlpr}/usr/local/Brother/Printer/mfc5890cn + dir=$out/usr/local/Brother/Printer/mfc5890cn + + interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 + patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1" + + #comment out lpadmin commands to prohibit changes to CUPS config by just installing this driver. + substituteInPlace $dir/cupswrapper/cupswrappermfc5890cn \ + --replace "lpadmin" "#lpadmin" \ + --replace "/usr/" "$out/usr/" + + #mfc5890cnlpr is a dependency of this package. Link all files of mfc5890cnlpr into the $out/usr folder, as other scripts depend on these files being present. + #Ideally, we would use substituteInPlace for each file this package actually requires. But the scripts of Brother use variables to dynamically build the paths + #at runtime, making this approach more complex. Hence, the easier route of simply linking all files was choosen. + find "$lpr" -type f -exec sh -c "mkdir -vp \$(echo '{}' | sed 's|$lpr|$dir|g' | xargs dirname) && ln -s '{}' \$(echo '{}' | sed 's|$lpr|$dir|g')" \; + + mkdir -p $out/usr/share/ppd/ + mkdir -p $out/usr/lib64/cups/filter + sed -i '941,972d' $dir/cupswrapper/cupswrappermfc5890cn + $dir/cupswrapper/cupswrappermfc5890cn + + chmod +x $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn + wrapProgram $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn --prefix PATH : ${lib.makeBinPath [coreutils psutils gnugrep gnused]} + + mkdir -p $out/lib/cups/filter + mkdir -p $out/share/cups/model + ln $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn $out/lib/cups/filter + ln $dir/cupswrapper/cupswrappermfc5890cn $out/lib/cups/filter + ln $out/usr/share/ppd/brmfc5890cn.ppd $out/share/cups/model + ''; + + meta = with lib; { + description = "Brother MFC-5890CN CUPS wrapper driver."; + londDescription = "Brother MFC-5890CN CUPS wrapper driver. Use the connection string 'lpd://\${IP_ADDRESS}/binary_p1' when connecting to this printer via the network."; + homepage = "http://www.brother.com/"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ martinramm ]; + }; +} diff --git a/pkgs/misc/cups/drivers/mfc5890cnlpr/default.nix b/pkgs/misc/cups/drivers/mfc5890cnlpr/default.nix new file mode 100644 index 0000000000000..7878d77afc043 --- /dev/null +++ b/pkgs/misc/cups/drivers/mfc5890cnlpr/default.nix @@ -0,0 +1,75 @@ +{ stdenv +, a2ps +, lib +, fetchurl +, dpkg +, makeWrapper +, coreutils +, file +, gawk +, ghostscript +, gnused +, pkgsi686Linux +}: + +stdenv.mkDerivation rec { + pname = "mfc5890cnlpr"; + version = "1.1.2-2"; + + src = fetchurl { + url = "https://download.brother.com/welcome/dlf006168/${pname}-${version}.i386.deb"; + sha256 = "119h3s1p9pv83mrfv6cmxpc0v33xf8c9nw5clj9yafv3aizxy6dp"; + }; + + unpackPhase = '' + dpkg-deb -x $src $out + ''; + + nativeBuildInputs = [ + dpkg + makeWrapper + ]; + + dontBuild = true; + + installPhase = '' + dir=$out/usr/local/Brother/Printer/mfc5890cn + + patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $dir/lpd/brmfc5890cnfilter + + wrapProgram $dir/inf/setupPrintcapij \ + --prefix PATH : ${lib.makeBinPath [ + coreutils + ]} + + substituteInPlace $dir/lpd/filtermfc5890cn \ + --replace "/usr/" "$out/usr/" + + wrapProgram $dir/lpd/filtermfc5890cn \ + --prefix PATH : ${lib.makeBinPath [ + a2ps + 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-5890CN LPR printer driver"; + homepage = "http://www.brother.com/"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.unfree; + maintainers = with maintainers; [ martinramm ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} |