python311Packages.img2pdf: fix evaluation on darwin

The img2pdf derivation uses the sRGB ICC profile provided by colord
starting with #264119. colord and several of its dependencies only
support Linux, so this broke evaluation on Darwin. This change drops the
use of colord on Darwin to fix the derivation; the system-provided sRGB
profile is used instead.
This commit is contained in:
Alex James 2023-11-05 10:42:19 -06:00
parent 968712dca9
commit 12cc200d43
No known key found for this signature in database
GPG Key ID: 2811C5BA55DA7094
2 changed files with 11 additions and 2 deletions

View File

@ -14,7 +14,7 @@ index 036232b..d2e7829 100755
- if os.path.exists(profile):
- return profile
- return "/usr/share/color/icc/sRGB.icc"
+ return "@colord@/share/color/icc/colord/sRGB.icc"
+ return "@srgbProfile@"
def get_main_parser():

View File

@ -38,7 +38,10 @@ buildPythonPackage rec {
patches = [
(substituteAll {
src = ./default-icc-profile.patch;
inherit colord;
srgbProfile = if stdenv.isDarwin then
"/System/Library/ColorSync/Profiles/sRGB Profile.icc"
else
"${colord}/share/color/icc/colord/sRGB.icc";
})
(fetchpatch {
# https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
@ -57,6 +60,12 @@ buildPythonPackage rec {
pillow
];
# FIXME: Only add "sRGB Profile.icc" to __impureHostDeps once
# https://github.com/NixOS/nix/issues/9301 is fixed.
__impureHostDeps = lib.optionals stdenv.isDarwin [
"/System/Library/ColorSync/Profiles"
];
nativeCheckInputs = [
exiftool
ghostscript