diff --git a/configuration.nix b/configuration.nix index bdbe318..9b68798 100644 --- a/configuration.nix +++ b/configuration.nix @@ -187,6 +187,8 @@ in (python311.withPackages (pythonPackages: with pythonPackages; [ urwid ])) + + # (pkgs.callPackage ./mfcl2690dw/default.nix { }) ]; networking.firewall.allowedTCPPorts = [ 22 ]; diff --git a/mfcl2690dw/default.nix b/mfcl2690dw/default.nix new file mode 100644 index 0000000..3d2e645 --- /dev/null +++ b/mfcl2690dw/default.nix @@ -0,0 +1,44 @@ +{ pkgsi686Linux, lib, stdenv, fetchurl, dpkg, makeWrapper, coreutils, ghostscript, gnugrep, gnused, which, perl }: + +stdenv.mkDerivation rec { + pname = "mfcl2690dwpdrv"; + version = "4.0.0-1"; + + src = fetchurl { + url = "https://download.brother.com/welcome/dlf101727/${pname}-${version}.i386.deb"; + sha256 = "765da49f1f0d68ed36ba553e6e60aa5030e87845b74afe0d7d46ebab28ab5256"; + }; + + nativeBuildInputs = [ dpkg makeWrapper ]; + + unpackPhase = "dpkg-deb -x $src $out"; + + installPhase = '' + dir=$out/opt/brother/Printers/MFCL2690DW + + substituteInPlace $dir/lpd/lpdfilter \ + --replace /usr/bin/perl ${perl}/bin/perl \ + --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \ + --replace "PRINTER =~" "PRINTER = \"MFCL2690DW\"; #" + + wrapProgram $dir/lpd/filter_MFCL2690DW \ + --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-L2690DW lpr driver"; + homepage = "http://www.brother.com/"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + license = lib.licenses.unfree; + platforms = [ "x86_64-linux" "i686-linux" ]; + maintainers = [ lib.maintainers.Enzime ]; + }; +}