summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2023-11-18 17:52:35 +0200
committerGitHub <noreply@github.com>2023-11-18 17:52:35 +0200
commit2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2 (patch)
tree3790a908e5a8534e76a0da9c4dfda68d0e16231f /pkgs/misc
parent73397aa32fbebb4ebae094bb81df91aa813f9628 (diff)
parentb4c4f471a6d8bb0689e0310f0418bdd3ff489ee9 (diff)
downloadnixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar.gz
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar.bz2
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar.lz
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar.xz
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.tar.zst
nixpkgs-2d24100bcf7e0d06a9dd0ba44f4df255eefca1a2.zip
Merge pull request #246429 from marcovergueira/dcp375cw-lpr-cupswrapper
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/cups/drivers/brother/dcp375cw/default.nix97
1 files changed, 97 insertions, 0 deletions
diff --git a/pkgs/misc/cups/drivers/brother/dcp375cw/default.nix b/pkgs/misc/cups/drivers/brother/dcp375cw/default.nix
new file mode 100644
index 00000000000..c9e92e839a0
--- /dev/null
+++ b/pkgs/misc/cups/drivers/brother/dcp375cw/default.nix
@@ -0,0 +1,97 @@
+{ lib, stdenv, fetchurl, cups, dpkg, gnused, makeWrapper, ghostscript, file
+, a2ps, coreutils, gnugrep, which, gawk }:
+
+let
+  version = "1.1.3";
+  model = "dcp375cw";
+in rec {
+  driver = stdenv.mkDerivation {
+    pname = "${model}-lpr";
+    inherit version;
+
+    src = fetchurl {
+      url =
+        "https://download.brother.com/welcome/dlf005427/dcp375cwlpr-${version}-1.i386.deb";
+      sha256 =
+        "6daf0144b5802ea8da394ca14db0e6f0200d4049545649283791f899b7f7bd26";
+    };
+
+    nativeBuildInputs = [ dpkg makeWrapper ];
+    buildInputs = [ cups ghostscript a2ps gawk ];
+    unpackPhase = "dpkg-deb -x $src $out";
+
+    installPhase = ''
+      substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
+      --replace /opt "$out/opt"
+
+      patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      $out/opt/brother/Printers/${model}/lpd/br${model}filter
+
+      mkdir -p $out/lib/cups/filter/
+      ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brlpdwrapper${model}
+
+      wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
+        --prefix PATH ":" ${
+          lib.makeBinPath [
+            gawk
+            ghostscript
+            a2ps
+            file
+            gnused
+            gnugrep
+            coreutils
+            which
+          ]
+        }
+    '';
+
+    meta = with lib; {
+      homepage = "http://www.brother.com/";
+      description = "Brother ${model} printer driver";
+      sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+      license = licenses.unfree;
+      platforms = platforms.linux;
+      downloadPage =
+        "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
+      maintainers = with maintainers; [ marcovergueira ];
+    };
+  };
+
+  cupswrapper = stdenv.mkDerivation {
+    pname = "${model}-cupswrapper";
+    inherit version;
+
+    src = fetchurl {
+      url =
+        "https://download.brother.com/welcome/dlf005429/dcp375cwcupswrapper-${version}-1.i386.deb";
+      sha256 =
+        "9a255728b595d2667b2caf9d0d332b677e1a6829a3ec1ed6d4e900a44069cf2d";
+    };
+
+    nativeBuildInputs = [ dpkg makeWrapper ];
+    buildInputs = [ cups ghostscript a2ps gawk ];
+    unpackPhase = "dpkg-deb -x $src $out";
+
+    installPhase = ''
+      for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
+        wrapProgram $f --prefix PATH : ${
+          lib.makeBinPath [ coreutils ghostscript gnugrep gnused ]
+        }
+      done
+
+      mkdir -p $out/share/cups/model
+      ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
+    '';
+
+    meta = with lib; {
+      homepage = "http://www.brother.com/";
+      description = "Brother ${model} printer CUPS wrapper driver";
+      sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+      license = licenses.unfree;
+      platforms = platforms.linux;
+      downloadPage =
+        "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
+      maintainers = with maintainers; [ marcovergueira ];
+    };
+  };
+}