From db216f91c29934cd6259cd6e80191600f57b0517 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 5 Dec 2024 19:52:08 +0100 Subject: [PATCH] ghostscript: support SOURCE_DATE_EPOCH for reproducible builds Without this patch, it is impossible to generate PDF documents in a reproducible way using Ghostscript, as CreationDate and ModDate are included in the PDF, which are based on the current time. I ran into this problem while using the LATEX command `\includegraphics` with an `.eps` graphic. The Ghostscript developers are not interested in fixing this and rejected the patch, see https://bugs.ghostscript.com/show_bug.cgi?id=696765#c28. [Debian carries the same patch](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794004), as does [Arch Linux](https://gitlab.archlinux.org/archlinux/packaging/packages/ghostscript/-/commit/426e6bf6f290c1acf1816c032c630d921b626c95). --- pkgs/by-name/gh/ghostscript/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/gh/ghostscript/package.nix b/pkgs/by-name/gh/ghostscript/package.nix index c9557858a161..ccf1daa72ffb 100644 --- a/pkgs/by-name/gh/ghostscript/package.nix +++ b/pkgs/by-name/gh/ghostscript/package.nix @@ -2,6 +2,7 @@ , stdenv , lib , fetchurl +, fetchpatch2 , pkg-config , zlib , expat @@ -72,6 +73,12 @@ stdenv.mkDerivation rec { patches = [ ./urw-font-files.patch ./doc-no-ref.diff + + # Support SOURCE_DATE_EPOCH for reproducible builds + (fetchpatch2 { + url = "https://salsa.debian.org/debian/ghostscript/-/raw/01e895fea033cc35054d1b68010de9818fa4a8fc/debian/patches/2010_add_build_timestamp_setting.patch"; + hash = "sha256-XTKkFKzMR2QpcS1YqoxzJnyuGk/l/Y2jdevsmbMtCXA="; + }) ]; outputs = [ "out" "man" "doc" "fonts" ];