From b89c9e137b6d666936d5a700cc19b7d0dc0d0a78 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Wed, 2 Dec 2020 19:35:35 +0000 Subject: [PATCH] Update private, use propriatery printer driver --- configuration.nix | 12 +---- externals/packages/hll2300d/default.nix | 70 +++++++++++++++++++++++++ private | 2 +- 3 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 externals/packages/hll2300d/default.nix diff --git a/configuration.nix b/configuration.nix index 1054b8e..3ba49c6 100644 --- a/configuration.nix +++ b/configuration.nix @@ -58,15 +58,7 @@ printing = { enable = true; drivers = [ - (pkgs.brlaser.overrideAttrs (old: { - patches = [ - (pkgs.fetchpatch { - name = "l2300d-fix.patch"; - url = "https://patch-diff.githubusercontent.com/raw/pdewacht/brlaser/pull/68.patch"; - sha256 = "07iqv048q0iplghn0aamjslyixw1p5jbk004i20xnl1vs95nyqzy"; - }) - ]; - })) + (pkgs.pkgsi686Linux.callPackage ./externals/packages/hll2300d { }) ]; }; }; @@ -101,7 +93,7 @@ group = "artemis"; # hashedPassword set in private }; - groups.artemis.gid = config.users.artemis.uid; + groups.artemis.gid = config.users.users.artemis.uid; mutableUsers = false; }; systemd.extraConfig = "DefaultLimitCORE=infinity"; diff --git a/externals/packages/hll2300d/default.nix b/externals/packages/hll2300d/default.nix new file mode 100644 index 0000000..27a63ed --- /dev/null +++ b/externals/packages/hll2300d/default.nix @@ -0,0 +1,70 @@ +{ stdenv, fetchurl, cups, dpkg, gnused, makeWrapper, ghostscript, file, a2ps, coreutils, gawk, perl, gnugrep, which }: +let + version = "3.2.0-1"; + lprdeb = fetchurl { + url = "https://download.brother.com/welcome/dlf101900/hll2300dlpr-${version}.i386.deb"; + sha256 = "093ya7qykhk8mnbiwz1wy0qly66mmk0ghd1rgla25biask5nnmwv"; + }; + + cupsdeb = fetchurl { + url = "https://download.brother.com/welcome/dlf101901/hll2300dcupswrapper-${version}.i386.deb"; + sha256 = "1fylsbnxbljh517lbdr3324jsi4fwhbfh6gzrdvifg0wl20vfwqr"; + }; + +in +stdenv.mkDerivation { + name = "cups-brother-hll2300dw"; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ cups ghostscript dpkg a2ps ]; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out + dpkg-deb -x ${cupsdeb} $out + dpkg-deb -x ${lprdeb} $out + + substituteInPlace $out/opt/brother/Printers/HLL2300D/lpd/filter_HLL2300D \ + --replace /opt "$out/opt" \ + --replace /usr/bin/perl ${perl}/bin/perl \ + --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2300D/\"; #" \ + --replace "PRINTER =~" "PRINTER = \"HLL2300D\"; #" + + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + $out/opt/brother/Printers/HLL2300D/lpd/brprintconflsr3 + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + $out/opt/brother/Printers/HLL2300D/lpd/rawtobr3 + + for f in \ + $out/opt/brother/Printers/HLL2300D/cupswrapper/brother_lpdwrapper_HLL2300D \ + $out/opt/brother/Printers/HLL2300D/cupswrapper/paperconfigml1 \ + ; do + wrapProgram $f \ + --prefix PATH : ${stdenv.lib.makeBinPath [ + coreutils + ghostscript + gnugrep + gnused + ]} + done + + mkdir -p $out/lib/cups/filter/ + ln -s $out/opt/brother/Printers/HLL2300D/lpd/filter_HLL2300D $out/lib/cups/filter/brother_lpdwrapper_HLL2300D + + mkdir -p $out/share/cups/model + ln -s $out/opt/brother/Printers/HLL2300D/cupswrapper/brother-HLL2300D-cups-en.ppd $out/share/cups/model/ + + wrapProgram $out/opt/brother/Printers/HLL2300D/lpd/filter_HLL2300D \ + --prefix PATH ":" ${ stdenv.lib.makeBinPath [ ghostscript a2ps file gnused gnugrep coreutils which ] } + ''; + + meta = with stdenv.lib; { + homepage = "http://www.brother.com/"; + description = "Brother hl-l2300dw printer driver"; + license = licenses.unfree; + platforms = platforms.linux; + downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=de&lang=de&prod=hll2300d_us_eu_as&os=128&flang=English"; + maintainers = [ maintainers.artemist ]; + }; +} diff --git a/private b/private index 2f3480e..88c78bc 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 2f3480efc17b6cbd3edf01f2cee877ce2c9a8cf4 +Subproject commit 88c78bc62bf8be3deaaf9f986fced5a6da46ff76