From 6f622e91c5daefe73b4c988d375a854a37bf92a7 Mon Sep 17 00:00:00 2001
From: Yarny0 <41838844+Yarny0@users.noreply.github.com>
Date: Wed, 7 Jul 2021 20:25:06 +0200
Subject: [PATCH] cups-drv-rastertosag-gdi (cups driver): gzip ppd files

ppd files are gzipped to save some space.
The `gzip` "-n" option prevents gzip from storing
a timestamp, thus facilitating reproducibility.
---
 .../doc/manual/from_md/release-notes/rl-2211.section.xml | 9 +++++++++
 nixos/doc/manual/release-notes/rl-2211.section.md        | 2 ++
 .../cups/drivers/cups-drv-rastertosag-gdi/default.nix    | 3 +++
 3 files changed, 14 insertions(+)

diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
index b731b8b72a3d..02cb2dd9ccd1 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
@@ -643,6 +643,15 @@
           maintainer to update the package.
         </para>
       </listitem>
+      <listitem>
+        <para>
+          ppd files in <literal>pkgs.cups-drv-rastertosag-gdi</literal>
+          are now gzipped. If you refer to such a ppd file with its path
+          (e.g. via
+          <link xlink:href="options.html#opt-hardware.printers.ensurePrinters">hardware.printers.ensurePrinters</link>)
+          you will need to append <literal>.gz</literal> to the path.
+        </para>
+      </listitem>
       <listitem>
         <para>
           xow package removed along with the
diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md
index 0f0e3c7a2e55..43abb40b8a04 100644
--- a/nixos/doc/manual/release-notes/rl-2211.section.md
+++ b/nixos/doc/manual/release-notes/rl-2211.section.md
@@ -210,6 +210,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
 
 - riak package removed along with `services.riak` module, due to lack of maintainer to update the package.
 
+- ppd files in `pkgs.cups-drv-rastertosag-gdi` are now gzipped.  If you refer to such a ppd file with its path (e.g. via [hardware.printers.ensurePrinters](options.html#opt-hardware.printers.ensurePrinters)) you will need to append `.gz` to the path.
+
 - xow package removed along with the `hardware.xow` module, due to the project being deprecated in favor of `xone`,  which is available via the `hardware.xone` module.
 
 - dd-agent package removed along with the `services.dd-agent` module, due to the project being deprecated in favor of `datadog-agent`,  which is available via the `services.datadog-agent` module.
diff --git a/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix b/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
index 683b1b64bca9..2032fa8457d4 100644
--- a/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
+++ b/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
@@ -35,6 +35,9 @@ python3Packages.buildPythonApplication rec {
     ln -vst "${placeholder "out"}/lib/cups/filter/" "${placeholder "out"}/bin/rastertosag-gdi"
     runHook postInstall
   '';
+  postFixup = ''
+    gzip -9nv "${placeholder "out"}/share/cups/model/rastertosag-gdi"/*.ppd
+  '';
   meta = {
     description = "CUPS driver for Ricoh Aficio SP 1000S and SP 1100S printers";
     downloadPage = "https://www.openprinting.org/download/printing/rastertosag-gdi/";