From bfe3271fc0cc6d0a471f8ef4ebe466cd8cf4c949 Mon Sep 17 00:00:00 2001 From: Yarny0 <41838844+Yarny0@users.noreply.github.com> Date: Wed, 7 Jul 2021 21:41:32 +0200 Subject: [PATCH] samsung-unified-linux-driver (cups driver): use patchPpdFilesHook The `sed` script in the `installPhase` is removed. Instead, the setup hook `patchPpdFilesHook` is used to patch the path to the filter executables. The result should essentially be the same. Comparing the generated ppd files showed no difference, short of the package's hash in the absolute paths and added newline characters at the end of some ppd files. Missing newline characters at the end of the last line are apparently added by `awk`; this shouldn't affect functionality. The new package also contains a `propagated-build-inputs` file which propagates the package itself. This ensures the package is available whenever a ppd file is singled out by another package. --- pkgs/misc/cups/drivers/samsung/4.01.17.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/misc/cups/drivers/samsung/4.01.17.nix b/pkgs/misc/cups/drivers/samsung/4.01.17.nix index 12cfcde82f76..dc9cb8f0515b 100644 --- a/pkgs/misc/cups/drivers/samsung/4.01.17.nix +++ b/pkgs/misc/cups/drivers/samsung/4.01.17.nix @@ -11,7 +11,13 @@ # } # (This advice was tested on the 1st November 2016.) -{ lib, stdenv, fetchurl, cups, libusb-compat-0_1 }: +{ lib +, stdenv +, cups +, libusb-compat-0_1 +, fetchurl +, patchPpdFilesHook +}: # Do not bump lightly! Visit # to see what will break when upgrading. Consider a new versioned attribute. @@ -28,6 +34,8 @@ in stdenv.mkDerivation rec { sha256 = "1vv3pzvqpg1dq3xjr8161x2yp3v7ca75vil56ranhw5pkjwq66x0"; }; + nativeBuildInputs = [ patchPpdFilesHook ]; + dontPatchELF = true; dontStrip = true; @@ -63,15 +71,11 @@ in stdenv.mkDerivation rec { mkdir -p $out/share/cups/model/samsung cd - cd ../noarch/at_opt/share/ppd - for i in *.ppd; do - sed -i $i -e \ - "s,pstosecps,$out/lib/cups/filter/pstosecps,g; \ - s,pstospl,$out/lib/cups/filter/pstospl,g; \ - s,rastertospl,$out/lib/cups/filter/rastertospl,g" - done; cp -r ./* $out/share/cups/model/samsung ''; + ppdFileCommands = [ "pstosecps" "pstospl" "rastertospl" ]; + meta = with lib; { description = "Samsung's Linux printing drivers; includes binaries without source code"; homepage = "http://www.samsung.com/";