Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 106 lines 2.4 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 isPy27, 5 fetchFromGitea, 6 substituteAll, 7 fetchpatch, 8 colord, 9 setuptools, 10 pikepdf, 11 pillow, 12 stdenv, 13 exiftool, 14 ghostscript, 15 imagemagick, 16 mupdf-headless, 17 netpbm, 18 numpy, 19 poppler_utils, 20 pytestCheckHook, 21 runCommand, 22 scipy, 23}: 24 25buildPythonPackage rec { 26 pname = "img2pdf"; 27 version = "0.5.1"; 28 disabled = isPy27; 29 30 pyproject = true; 31 32 src = fetchFromGitea { 33 domain = "gitlab.mister-muffin.de"; 34 owner = "josch"; 35 repo = "img2pdf"; 36 rev = version; 37 hash = "sha256-mrNTc37GrHTc7NW0sYI1FlAOlnvXum02867enqHsAEQ="; 38 }; 39 40 patches = [ 41 (substituteAll { 42 src = ./default-icc-profile.patch; 43 srgbProfile = 44 if stdenv.hostPlatform.isDarwin then 45 "/System/Library/ColorSync/Profiles/sRGB Profile.icc" 46 else 47 # break runtime dependency chain all of colord dependencies 48 runCommand "sRGC.icc" { } '' 49 cp ${colord}/share/color/icc/colord/sRGB.icc $out 50 ''; 51 }) 52 (fetchpatch { 53 # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178 54 url = "https://salsa.debian.org/debian/img2pdf/-/raw/4a7dbda0f473f7c5ffcaaf68ea4ad3f435e0920d/debian/patches/fix_tests.patch"; 55 hash = "sha256-A1zK6yINhS+dvyckZjqoSO1XJRTaf4OXFdq5ufUrBs8="; 56 }) 57 ]; 58 59 nativeBuildInputs = [ setuptools ]; 60 61 propagatedBuildInputs = [ 62 pikepdf 63 pillow 64 ]; 65 66 # FIXME: Only add "sRGB Profile.icc" to __impureHostDeps once 67 # https://github.com/NixOS/nix/issues/9301 is fixed. 68 __impureHostDeps = lib.optionals stdenv.hostPlatform.isDarwin [ 69 "/System/Library/ColorSync/Profiles" 70 ]; 71 72 nativeCheckInputs = [ 73 exiftool 74 ghostscript 75 imagemagick 76 mupdf-headless 77 netpbm 78 numpy 79 poppler_utils 80 pytestCheckHook 81 scipy 82 ]; 83 84 preCheck = '' 85 export img2pdfprog="$out/bin/img2pdf" 86 ''; 87 88 disabledTests = [ 89 # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178 90 "test_miff_cmyk16" 91 ]; 92 93 pythonImportsCheck = [ "img2pdf" ]; 94 95 meta = with lib; { 96 changelog = "https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/${src.rev}/CHANGES.rst"; 97 description = "Convert images to PDF via direct JPEG inclusion"; 98 homepage = "https://gitlab.mister-muffin.de/josch/img2pdf"; 99 license = licenses.lgpl3Plus; 100 mainProgram = "img2pdf"; 101 maintainers = with maintainers; [ 102 veprbl 103 dotlambda 104 ]; 105 }; 106}