at 22.05-pre 2.4 kB view raw
1{ lib 2, buildPythonPackage 3, python 4, pythonOlder 5, fetchFromGitLab 6, substituteAll 7, bubblewrap 8, exiftool 9, ffmpeg 10, mime-types 11, wrapGAppsHook 12, gdk-pixbuf 13, gobject-introspection 14, librsvg 15, poppler_gi 16, mutagen 17, pygobject3 18, pycairo 19, dolphinIntegration ? false, plasma5Packages 20}: 21 22buildPythonPackage rec { 23 pname = "mat2"; 24 version = "0.12.2"; 25 26 disabled = pythonOlder "3.5"; 27 28 src = fetchFromGitLab { 29 domain = "0xacab.org"; 30 owner = "jvoisin"; 31 repo = "mat2"; 32 rev = version; 33 sha256 = "sha256-KaHdBmTeBlCRaVkG3WsfDtFo45s/X69x7VGDYY7W5O8="; 34 }; 35 36 patches = [ 37 # hardcode paths to some binaries 38 (substituteAll ({ 39 src = ./paths.patch; 40 bwrap = "${bubblewrap}/bin/bwrap"; 41 exiftool = "${exiftool}/bin/exiftool"; 42 ffmpeg = "${ffmpeg}/bin/ffmpeg"; 43 # remove once faf0f8a8a4134edbeec0a73de7f938453444186d is in master 44 mimetypes = "${mime-types}/etc/mime.types"; 45 } // lib.optionalAttrs dolphinIntegration { 46 kdialog = "${plasma5Packages.kdialog}/bin/kdialog"; 47 })) 48 # the executable shouldn't be called .mat2-wrapped 49 ./executable-name.patch 50 # hardcode path to mat2 executable 51 ./tests.patch 52 ]; 53 54 postPatch = '' 55 substituteInPlace dolphin/mat2.desktop \ 56 --replace "@mat2@" "$out/bin/mat2" \ 57 --replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg" 58 ''; 59 60 nativeBuildInputs = [ 61 wrapGAppsHook 62 ]; 63 64 buildInputs = [ 65 gdk-pixbuf 66 gobject-introspection 67 librsvg 68 poppler_gi 69 ]; 70 71 propagatedBuildInputs = [ 72 mutagen 73 pygobject3 74 pycairo 75 ]; 76 77 postInstall = '' 78 install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps" 79 install -Dm 444 doc/mat2.1 -t "$out/share/man/man1" 80 install -Dm 444 nautilus/mat2.py -t "$out/share/nautilus-python/extensions" 81 buildPythonPath "$out $pythonPath" 82 patchPythonScript "$out/share/nautilus-python/extensions/mat2.py" 83 '' + lib.optionalString dolphinIntegration '' 84 install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus" 85 ''; 86 87 checkPhase = '' 88 ${python.interpreter} -m unittest discover -v 89 ''; 90 91 meta = with lib; { 92 description = "A handy tool to trash your metadata"; 93 homepage = "https://0xacab.org/jvoisin/mat2"; 94 changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md"; 95 license = licenses.lgpl3Plus; 96 maintainers = with maintainers; [ dotlambda ]; 97 }; 98}