about summary refs log tree commit diff
path: root/nixpkgs/pkgs/misc/cups
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/misc/cups')
-rw-r--r--nixpkgs/pkgs/misc/cups/default.nix4
-rw-r--r--nixpkgs/pkgs/misc/cups/drivers/cnijfilter2/default.nix2
-rw-r--r--nixpkgs/pkgs/misc/cups/drivers/hl2260d/default.nix89
3 files changed, 92 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/misc/cups/default.nix b/nixpkgs/pkgs/misc/cups/default.nix
index 99d56af97c3d..ba414d7aec5b 100644
--- a/nixpkgs/pkgs/misc/cups/default.nix
+++ b/nixpkgs/pkgs/misc/cups/default.nix
@@ -23,11 +23,11 @@
 
 stdenv.mkDerivation rec {
   pname = "cups";
-  version = "2.4.6";
+  version = "2.4.7";
 
   src = fetchurl {
     url = "https://github.com/OpenPrinting/cups/releases/download/v${version}/cups-${version}-source.tar.gz";
-    sha256 = "sha256-WOlwzxlV4cyH0IR8MlJtnCzO4zXl8OOIKygxOLoOcmI=";
+    sha256 = "sha256-3VQijdkDUmQozn43lhr67SMK0xB4gUHadc66oINiz2w=";
   };
 
   outputs = [ "out" "lib" "dev" "man" ];
diff --git a/nixpkgs/pkgs/misc/cups/drivers/cnijfilter2/default.nix b/nixpkgs/pkgs/misc/cups/drivers/cnijfilter2/default.nix
index 8390d5e0ba84..8520ba7aff2e 100644
--- a/nixpkgs/pkgs/misc/cups/drivers/cnijfilter2/default.nix
+++ b/nixpkgs/pkgs/misc/cups/drivers/cnijfilter2/default.nix
@@ -145,6 +145,6 @@ stdenv.mkDerivation {
     homepage = "https://hk.canon/en/support/0101048401/1";
     license = licenses.unfree;
     platforms = [ "i686-linux" "x86_64-linux" ];
-    maintainers = with maintainers; [ cstrahan ];
+    maintainers = with maintainers; [ ];
   };
 }
diff --git a/nixpkgs/pkgs/misc/cups/drivers/hl2260d/default.nix b/nixpkgs/pkgs/misc/cups/drivers/hl2260d/default.nix
new file mode 100644
index 000000000000..9883bd99a314
--- /dev/null
+++ b/nixpkgs/pkgs/misc/cups/drivers/hl2260d/default.nix
@@ -0,0 +1,89 @@
+{ lib, stdenv, fetchurl, cups, dpkg, gnused, makeWrapper, ghostscript, coreutils, perl, gnugrep, which
+, debugLvl ? "0"
+}:
+
+let
+  version = "3.2.0-1";
+  lprdeb = fetchurl {
+    url = "https://download.brother.com/welcome/dlf102692/hl2260dlpr-${version}.i386.deb";
+    hash = "sha256-R+cM2SKc/MP6keo3PUrKXPC6a2dEQQdBunrpNtAHlH0=";
+  };
+
+  cupsdeb = fetchurl {
+    url = "https://download.brother.com/welcome/dlf102693/hl2260dcupswrapper-${version}.i386.deb";
+    hash = "sha256-k6+ulZVoFTpEY6WJ9TO9Rzp2c4dwPqL3NY5/XYJpvOc=";
+  };
+in
+stdenv.mkDerivation {
+  pname = "cups-brother-hl2260d";
+  inherit version;
+
+  nativeBuildInputs = [ makeWrapper dpkg ];
+  buildInputs = [ cups ghostscript perl ];
+
+  dontPatchELF = true;
+  dontBuild = true;
+
+  unpackPhase = ''
+    mkdir -p $out
+    dpkg-deb -x ${cupsdeb} $out
+    dpkg-deb -x ${lprdeb} $out
+  '';
+
+  patchPhase = ''
+    # Patch lpr
+    INFDIR=$out/opt/brother/Printers/HL2260D/inf
+    LPDDIR=$out/opt/brother/Printers/HL2260D/lpd
+
+    substituteInPlace $LPDDIR/filter_HL2260D \
+      --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HL2260D\"; #" \
+      --replace "PRINTER =~" "PRINTER = \"HL2260D\"; #"
+
+    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      $INFDIR/braddprinter
+    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      $LPDDIR/brprintconflsr3
+    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      $LPDDIR/rawtobr3
+
+    # Patch cupswrapper
+    WRAPPER=$out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D
+    PAPER_CFG=$out/opt/brother/Printers/HL2260D/cupswrapper/paperconfigml1
+
+    substituteInPlace $WRAPPER \
+      --replace "basedir =~" "basedir = \"$out/opt/brother/Printers/HL2260D\"; #" \
+      --replace "PRINTER =~" "PRINTER = \"HL2260D\"; #" \
+      --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
+    substituteInPlace $WRAPPER \
+      --replace "\`cp " "\`cp -p " \
+      --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
+      --replace "\`mv " "\`cp -p "
+    # This config script make this assumption that the *.ppd are found in a global location `/etc/cups/ppd`.
+    substituteInPlace $PAPER_CFG \
+      --replace "/etc/cups/ppd" "$out/share/cups/model"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/cups/model
+    ln -s $out/opt/brother/Printers/HL2260D/cupswrapper/brother-HL2260D-cups-en.ppd $out/share/cups/model
+
+    mkdir -p $out/lib/cups/filter/
+    makeWrapper \
+      $out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D \
+      $out/lib/cups/filter/brother_lpdwrapper_HL2260D \
+      --prefix PATH : ${lib.makeBinPath [coreutils gnugrep gnused]}
+
+    wrapProgram $out/opt/brother/Printers/HL2260D/lpd/filter_HL2260D \
+      --prefix PATH ":" ${ lib.makeBinPath [ ghostscript which ] }
+    '';
+
+  meta = with lib; {
+    homepage = "http://www.brother.com/";
+    description = "Brother HL-2260D printer driver";
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" "i686-linux" ];
+    downloadPage = "https://support.brother.com/g/b/downloadtop.aspx?c=cn_ot&lang=en&prod=hl2260d_cn";
+    maintainers = with maintainers; [ u2x1 ];
+  };
+}