lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 83 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 dpkg, 6 makeWrapper, 7 coreutils, 8 gnugrep, 9 gnused, 10 mfc5890cnlpr, 11 pkgsi686Linux, 12 psutils, 13}: 14 15stdenv.mkDerivation rec { 16 pname = "mfc5890cncupswrapper"; 17 version = "1.1.2-2"; 18 19 src = fetchurl { 20 url = "https://download.brother.com/welcome/dlf006170/${pname}-${version}.i386.deb"; 21 hash = "sha256-UOCwzB09/a1/2rliY+hTrslSvO5ztVj51auisPx7OIQ="; 22 }; 23 24 unpackPhase = '' 25 dpkg-deb -x $src $out 26 ''; 27 28 nativeBuildInputs = [ 29 dpkg 30 makeWrapper 31 ]; 32 33 dontBuild = true; 34 35 installPhase = '' 36 lpr=${mfc5890cnlpr}/usr/local/Brother/Printer/mfc5890cn 37 dir=$out/usr/local/Brother/Printer/mfc5890cn 38 39 interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 40 patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1" 41 42 #comment out lpadmin commands to prohibit changes to CUPS config by just installing this driver. 43 substituteInPlace $dir/cupswrapper/cupswrappermfc5890cn \ 44 --replace "lpadmin" "#lpadmin" \ 45 --replace "/usr/" "$out/usr/" 46 47 #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. 48 #Ideally, we would use substituteInPlace for each file this package actually requires. But the scripts of Brother use variables to dynamically build the paths 49 #at runtime, making this approach more complex. Hence, the easier route of simply linking all files was choosen. 50 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')" \; 51 52 mkdir -p $out/usr/share/ppd/ 53 mkdir -p $out/usr/lib64/cups/filter 54 sed -i '941,972d' $dir/cupswrapper/cupswrappermfc5890cn 55 $dir/cupswrapper/cupswrappermfc5890cn 56 57 chmod +x $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn 58 wrapProgram $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn --prefix PATH : ${ 59 lib.makeBinPath [ 60 coreutils 61 psutils 62 gnugrep 63 gnused 64 ] 65 } 66 67 mkdir -p $out/lib/cups/filter 68 mkdir -p $out/share/cups/model 69 ln $out/usr/lib64/cups/filter/brlpdwrappermfc5890cn $out/lib/cups/filter 70 ln $dir/cupswrapper/cupswrappermfc5890cn $out/lib/cups/filter 71 ln $out/usr/share/ppd/brmfc5890cn.ppd $out/share/cups/model 72 ''; 73 74 meta = with lib; { 75 description = "Brother MFC-5890CN CUPS wrapper driver"; 76 longDescription = "Brother MFC-5890CN CUPS wrapper driver. Use the connection string 'lpd://\${IP_ADDRESS}/binary_p1' when connecting to this printer via the network."; 77 homepage = "http://www.brother.com/"; 78 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 79 license = licenses.gpl2Plus; 80 platforms = platforms.linux; 81 maintainers = with maintainers; [ martinramm ]; 82 }; 83}