From bf30b53817652cc0bdaca8fbf8891165e273e332 Mon Sep 17 00:00:00 2001 From: Yarny0 <41838844+Yarny0@users.noreply.github.com> Date: Wed, 7 Jul 2021 21:27:21 +0200 Subject: [PATCH] cups-kyocera (cups driver): use patchPpdFilesHook The `sed` script in the `installPhase` is removed. Instead, the setup hook `patchPpdFilesHook` is used to patch the path to `rastertokpsl`. 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). 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/kyocera/default.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkgs/misc/cups/drivers/kyocera/default.nix b/pkgs/misc/cups/drivers/kyocera/default.nix index 28b2a128176..12e6f5bb4ba 100644 --- a/pkgs/misc/cups/drivers/kyocera/default.nix +++ b/pkgs/misc/cups/drivers/kyocera/default.nix @@ -1,4 +1,9 @@ -{ stdenv, lib, fetchzip, cups }: +{ lib +, stdenv +, cups +, fetchzip +, patchPpdFilesHook +}: let platform = @@ -23,6 +28,8 @@ stdenv.mkDerivation { sha256 = "0z1pbgidkibv4j21z0ys8cq1lafc6687syqa07qij2qd8zp15wiz"; }; + nativeBuildInputs = [ patchPpdFilesHook ]; + installPhase = '' tar -xvf ${platform}/Global/English.tar.gz install -Dm755 English/rastertokpsl $out/lib/cups/filter/rastertokpsl @@ -33,13 +40,11 @@ stdenv.mkDerivation { mkdir -p $out/share/cups/model/Kyocera cd English - for i in *.ppd; do - sed -i $i -e \ - "s,/usr/lib/cups/filter/rastertokpsl,$out/lib/cups/filter/rastertokpsl,g" - cp $i $out/share/cups/model/Kyocera - done; + cp *.ppd $out/share/cups/model/Kyocera ''; + ppdFileCommands = [ "rastertokpsl" ]; + meta = with lib; { description = "CUPS drivers for several Kyocera FS-{1020,1025,1040,1060,1120,1125} printers"; homepage = "https://www.kyoceradocumentsolutions.ru/index/service_support/download_center.false.driver.FS1040._.EN.html#";