summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorYarny0 <41838844+Yarny0@users.noreply.github.com>2021-07-07 21:27:21 +0200
committerYarny0 <41838844+Yarny0@users.noreply.github.com>2022-11-06 16:19:22 +0100
commitbf30b53817652cc0bdaca8fbf8891165e273e332 (patch)
tree10d8b545561c3178d8e21f3a2bbbc030028b8125 /pkgs/misc
parentef8566f38b422f92759cdbaa5510c06fdb49106e (diff)
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.
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/cups/drivers/kyocera/default.nix17
1 files changed, 11 insertions, 6 deletions
diff --git a/pkgs/misc/cups/drivers/kyocera/default.nix b/pkgs/misc/cups/drivers/kyocera/default.nix
index 28b2a1281761e..12e6f5bb4baee 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#";