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