nixpkgs/pkgs/by-name/mf/mfcl2740dwlpr/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

45 lines
1.5 KiB
Nix

{ pkgsi686Linux, lib, stdenv, fetchurl, dpkg, makeWrapper, coreutils, ghostscript, gnugrep, gnused, which, perl }:
stdenv.mkDerivation rec {
pname = "mfcl2740dwlpr";
version = "3.2.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf101727/${pname}-${version}.i386.deb";
sha256 = "10a2bc672bd54e718b478f3afc7e47d451557f7d5513167d3ad349a3d00bffaf";
};
nativeBuildInputs = [ dpkg makeWrapper ];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
dir=$out/opt/brother/Printers/MFCL2740DW
substituteInPlace $dir/lpd/filter_MFCL2740DW \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"MFCL2740DW\"; #"
wrapProgram $dir/lpd/filter_MFCL2740DW \
--prefix PATH : ${lib.makeBinPath [
coreutils ghostscript gnugrep gnused which
]}
# need to use i686 glibc here, these are 32bit proprietary binaries
interpreter=${pkgsi686Linux.glibc}/lib/ld-linux.so.2
patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
'';
meta = {
description = "Brother MFC-L2740DW lpr driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = [ ];
};
}