2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
isPy27,
|
|
|
|
fetchFromGitea,
|
|
|
|
substituteAll,
|
|
|
|
fetchpatch,
|
|
|
|
colord,
|
|
|
|
setuptools,
|
|
|
|
pikepdf,
|
|
|
|
pillow,
|
|
|
|
stdenv,
|
|
|
|
exiftool,
|
|
|
|
ghostscript,
|
|
|
|
imagemagick,
|
|
|
|
mupdf-headless,
|
|
|
|
netpbm,
|
|
|
|
numpy,
|
|
|
|
poppler_utils,
|
|
|
|
pytestCheckHook,
|
|
|
|
runCommand,
|
|
|
|
scipy,
|
2022-01-13 20:06:32 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "img2pdf";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.5.1";
|
2020-07-18 16:06:22 +00:00
|
|
|
disabled = isPy27;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "gitlab.mister-muffin.de";
|
|
|
|
owner = "josch";
|
|
|
|
repo = "img2pdf";
|
|
|
|
rev = version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-mrNTc37GrHTc7NW0sYI1FlAOlnvXum02867enqHsAEQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-17 02:30:10 +00:00
|
|
|
patches = [
|
2023-11-16 04:20:00 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./default-icc-profile.patch;
|
2024-06-05 15:53:02 +00:00
|
|
|
srgbProfile =
|
2024-09-26 11:04:55 +00:00
|
|
|
if stdenv.hostPlatform.isDarwin then
|
2024-06-05 15:53:02 +00:00
|
|
|
"/System/Library/ColorSync/Profiles/sRGB Profile.icc"
|
|
|
|
else
|
|
|
|
# break runtime dependency chain all of colord dependencies
|
|
|
|
runCommand "sRGC.icc" { } ''
|
|
|
|
cp ${colord}/share/color/icc/colord/sRGB.icc $out
|
|
|
|
'';
|
2023-11-16 04:20:00 +00:00
|
|
|
})
|
2022-09-17 02:30:10 +00:00
|
|
|
(fetchpatch {
|
2023-11-16 04:20:00 +00:00
|
|
|
# https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
|
|
|
|
url = "https://salsa.debian.org/debian/img2pdf/-/raw/4a7dbda0f473f7c5ffcaaf68ea4ad3f435e0920d/debian/patches/fix_tests.patch";
|
|
|
|
hash = "sha256-A1zK6yINhS+dvyckZjqoSO1XJRTaf4OXFdq5ufUrBs8=";
|
2022-09-17 02:30:10 +00:00
|
|
|
})
|
2023-11-16 04:20:00 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2022-09-17 02:30:10 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2020-09-25 04:45:31 +00:00
|
|
|
pikepdf
|
2020-04-24 23:36:52 +00:00
|
|
|
pillow
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# FIXME: Only add "sRGB Profile.icc" to __impureHostDeps once
|
|
|
|
# https://github.com/NixOS/nix/issues/9301 is fixed.
|
2024-09-26 11:04:55 +00:00
|
|
|
__impureHostDeps = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
"/System/Library/ColorSync/Profiles"
|
|
|
|
];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-13 20:06:32 +00:00
|
|
|
exiftool
|
|
|
|
ghostscript
|
|
|
|
imagemagick
|
2024-01-25 14:12:00 +00:00
|
|
|
mupdf-headless
|
2022-01-13 20:06:32 +00:00
|
|
|
netpbm
|
|
|
|
numpy
|
|
|
|
poppler_utils
|
|
|
|
pytestCheckHook
|
|
|
|
scipy
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export img2pdfprog="$out/bin/img2pdf"
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
2023-11-16 04:20:00 +00:00
|
|
|
# https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
|
|
|
|
"test_miff_cmyk16"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "img2pdf" ];
|
2021-02-13 14:23:35 +00:00
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
changelog = "https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/${src.rev}/CHANGES.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Convert images to PDF via direct JPEG inclusion";
|
|
|
|
homepage = "https://gitlab.mister-muffin.de/josch/img2pdf";
|
2023-11-16 04:20:00 +00:00
|
|
|
license = licenses.lgpl3Plus;
|
|
|
|
mainProgram = "img2pdf";
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
veprbl
|
|
|
|
dotlambda
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|